본문 바로가기

IT/코딩테스트

[Leetcode] 1346. Check If N and Its Double Exist

728x90

https://leetcode.com/problems/check-if-n-and-its-double-exist/

class Solution:
    def checkIfExist(self, arr: List[int]) -> bool:
        arr.sort()
        for i in range(len(arr)):
            for j in range(len(arr)):
                if i == j:
                    continue
                if arr[i] * 2 == arr[j]:
                    return True
        return False
728x90