[LeetCode] Check If N and Its Double Exist (Python)

2024. 2. 29. 11:40자료구조

 

 

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