My Python simple solution


  • 2
    M
    class Solution(object):
        def containsDuplicate(self, nums):
            """
            :type nums: List[int]
            :rtype: bool
            """
            return not (len(nums) == len(set(nums)))
    

    This is extremely easy to understand :)


  • -9

    这个方法太简单了,不得不佩服,不知道还有人可以这样想,超乎预期


Log in to reply
 

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