We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8207ce commit 43737e5Copy full SHA for 43737e5
contains-duplicate/chordpli.py
@@ -0,0 +1,12 @@
1
+from typing import List
2
+
3
+class Solution:
4
+ def containsDuplicate(self, nums: List[int]) -> bool:
5
+ dic = {}
6
7
+ for num in nums:
8
+ if dic.get(num):
9
+ return True
10
+ dic[num] = 1
11
12
+ return False
two-sum/chordpli.py
@@ -0,0 +1,11 @@
+ def twoSum(self, nums: List[int], target: int) -> List[int]:
+ map = {}
+ for i, num in enumerate(nums):
+ complement = target - num
+ if complement in map:
+ return [map[complement], i]
+ map[num] = i
0 commit comments