Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

contains duplicate in python

#most efficient solution on Leet code
def containsDuplicate(self,nums)->bool:
        d={}
        for ele in nums:
            if ele not in d:
                d[ele] = 1
            else:
                return True
        return False
 
PREVIOUS NEXT
Tagged: #duplicate #python
ADD COMMENT
Topic
Name
1+7 =