My python solution


  • 0
    A
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        nums.sort()
        for i in range(0,len(nums),2):
            if (i != len(nums) - 1) and (nums[i] != nums[i+1]):
                return nums[i]
            elif i == len(nums) - 1:
                return nums[i]

Log in to reply
 

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