Skip to content

Commit b94fa5c

Browse files
Add files via upload
1 parent 651b4bd commit b94fa5c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Day137Question137/Solution.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from typing import List
2+
3+
class Solution:
4+
def singleNumber(self, nums: List[int]) -> int:
5+
ones, twos = 0, 0
6+
7+
for num in nums:
8+
ones = (ones ^ num) & ~twos
9+
twos = (twos ^ num) & ~ones
10+
11+
return ones

0 commit comments

Comments
 (0)