Skip to Main Content

Contains Duplicate

Problem URL:Contains Duplicate

My Solution

Python

def containsDuplicate(self, nums: List[int]) -> bool:
    hash_table = {}

    for num in nums:

        if num in hash_table:
            return True
        else:
            hash_table[num] = num

    return False

Let's Connect

Twitter GitHub LinkedIn