136. Single Number
Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 76% Topics: Array, Bit Manipulation
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(1)
import operator
from functools import reduce
class Solution(object):
"""
:type nums: List[int]
:rtype: int
"""
def singleNumber(self, A):
return reduce(operator.xor, A)
Solution from kamyu104/LeetCode-Solutions · MIT