# [Contains Duplicate](https://leetcode.com/problems/contains-duplicate/) ###### tags: `Leetcode`, `Easy`, `Arrays and Hashing` ## Approach * Initialize a hashset * Iterate through list and check if number is present in the hashset * If present, return False ## Asymptotic Analysis ### Time Complexity: **O(n)** ### Space Complexity: **O(n)** ## Code ``` python class Solution: def containsDuplicate(self, nums: List[int]) -> bool: # initialize a hashset numHash = set() # add elements to hashset for num in nums: if num in numHash: return True numHash.add(num) return False ```