python solution


  • 0
    H

    class Solution(object):
    def singleNumber(self, nums):
    """
    :type nums: List[int]
    :rtype: int
    """
    nums.sort()
    for x, y in zip(nums[::2], nums[1::2]):
    if x != y:
    return x
    return nums[-1]


Log in to reply
 

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