PYTHON with O(n) RT and O(1) space


  • 0
    M
    def singlenum(nums):
        A = sorted(nums)
        for i in range(0,len(A),2):
            if A[i] != A[i+1]:
                return A[i]
        return A[-1]
    

Log in to reply
 

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