bumpsoo 2024-12-01 20:40:35 +09:00
parent 87d3129bde
commit 6a2a68ee17

View file

@ -0,0 +1,16 @@
# 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