1 line python solution


  • 0
    A
    def containsDuplicate(self, nums):
        """
        :type nums: List[int]
        :rtype: bool
        """
        # need to import "collections" library
        return False if nums == [] else max(count for count in collections.Counter(nums).values()) >= 2

Log in to reply
 

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