Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 02f0965

Browse files
authored
Merge pull request #559 from Karnak123/1346-Check-if-N-and-its-double-exist
added solution to leetcode problem 1346
2 parents a976067 + eb446c6 commit 02f0965

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def checkIfExist(self, arr: List[int]) -> bool:
3+
4+
seen = set()
5+
for x in arr:
6+
if x * 2 in seen or (not x % 2 and x // 2 in seen):
7+
return True
8+
seen.add(x)
9+
return False

0 commit comments

Comments
 (0)