16 lines
419 B
Python
16 lines
419 B
Python
# https://leetcode.com/problems/check-if-n-and-its-double-exist
|
|
|
|
from typing import List
|
|
|
|
class Solution:
|
|
def checkIfExist(self, arr: List[int]) -> bool:
|
|
m = {key: True for key in arr}
|
|
i_count = 0
|
|
for i in arr:
|
|
if i == 0:
|
|
i_count += 1
|
|
continue
|
|
if i * 2 in m:
|
|
return True
|
|
return True if i_count > 1 else False
|
|
|