1 class Solution:
 2     def checkIfExist(self, arr: List[int]) -> bool:
 3         s = set()
 4         n = len(arr)
 5         for i in range(n):
 6             cur = arr[i]
 7             if cur in s:
 8                 return True
 9             if cur % 2 == 1:
10                 s.add(cur * 2)
11             else:
12                 s.add(cur * 2)
13                 s.add(cur // 2)
14         return False

 

posted on 2020-02-09 12:04  Sempron2800+  阅读(159)  评论(0编辑  收藏  举报