O(1) constant space solution with comment

  • 2
    class Solution(object):
        def singleNumber(self, nums):
            :type nums: List[int]
            :rtype: List[int]
            If the two numbers are m and n, the next few lines
            will get the least significant bit of 1 in m xor n.
            One of them has 1 on that bit and  the other one has 
            0 on that bit.
            for x in nums:
            Divide the numbers into two part by the value on 
            that bit, and xor those numbers
            for x in nums:
            return res

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.