2*set's sum minus list's sum,it is linear complex


  • 0
    Z

    class Solution(object):
    def singleNumber(self, nums):
    """
    :type nums: List[int]
    :rtype: int
    """
    if not nums:
    return
    return 2*sum(list(set(nums)))-sum(nums)


Log in to reply
 

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