Contains Duplicate

Not SpecifiedLeetcode
View on Platform

1️⃣1️⃣Contains Duplicate

Idea: Use hashing


💻 Code


def hasDuplicate(nums: List[int]) -> bool:
	set1 = set()
	for i in nums:
		if i not in set1:
			set1.add(i)
		else:
			return True
	return False

Local Graph View

Start typing to search
Try: two sum or #Arrays or #Amazon