Skip to content

Commit 817a920

Browse files
committed
Added Python solution for "Single Number"
1 parent 1db8d58 commit 817a920

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Python/Single Number.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from functools import reduce
2+
from operator import xor
3+
from typing import List
4+
5+
6+
class Solution:
7+
"""
8+
Time: O(n)
9+
Memory: O(1)
10+
"""
11+
12+
def singleNumber(self, nums: List[int]) -> int:
13+
return reduce(xor, nums)

0 commit comments

Comments
 (0)