nathanwailes

LeetCode 217 - Contains Duplicate - NeetCode solution

Oct 5th, 2023
1,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. class Solution:
  2.     def containsDuplicate(self, nums: List[int]) -> bool:
  3.         hashset = set()
  4.         for n in nums:
  5.             if n in hashset:
  6.                 return True
  7.             hashset.add(n)
  8.         return False
  9.  
Advertisement
Add Comment
Please, Sign In to add comment