217. Contains Duplicate

202401162300
tags: #two-pointers

class Solution(object):
	def containsDuplicate(self, nums):
		visited = set()
		for num in nums:
			if num in visited:
				return True
			visited.add(num)
	return False

Reference

https://leetcode.com/problems/contains-duplicate/