My Python solution


  • -3
    E
    class Solution:
        # @param {integer[]} nums
        # @return {boolean}
        def containsDuplicate(self, nums):
            if not nums:
                return False
            if len(nums) == 1:
                return False
            nums_set = set(nums)
            if len(nums_set) == len(nums):
                return False
            return True

Log in to reply
 

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