Skip to content
LC-0136 Easy LeetCode

136. Single Number

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 76% Topics: Array, Bit Manipulation
View full problem on LeetCode
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