class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
twice = {}
for n in nums:
if n not in twice:
twice[n] = 0
else:
twice[n] +=1
return True
return False'LeetCode > NeetCode' 카테고리의 다른 글
| BST: 278. First Bad Version ★ (0) | 2025.01.21 |
|---|---|
| BST: 704. Binary Search (0) | 2025.01.21 |
| HashMap 구현 (0) | 2025.01.20 |
| Heap-PrioiryQueue: 215. Kth Largest Element in an Array ★ (0) | 2025.01.20 |
| Heap-PrioiryQueue: 973. K Closest Points to Origin ★ (0) | 2025.01.20 |