Skip to content

Commit 96ef0e7

Browse files
authored
Switched from set to dict
1 parent 95fb1a6 commit 96ef0e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Python3/Single Number.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
class Solution:
22
def singleNumber(self, nums: List[int]) -> int:
3-
res = set()
3+
res = {}
44

55
for i in nums:
66
if i in res:
7-
res.remove(i)
7+
del res[i]
88
else:
9-
res.add(i)
9+
res[i] = True
1010

11-
return res.pop()
11+
return list(res)[0]

0 commit comments

Comments
 (0)