nathanwailes

LeetCode 217 - Contains Duplicate - 2023.10.05 solution

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