217. Contains Duplicate
Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 63% Topics: Array, Hash Table, Sorting
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(n)
class Solution(object):
# @param {integer[]} nums
# @return {boolean}
def containsDuplicate(self, nums):
return len(nums) > len(set(nums))
Solution from kamyu104/LeetCode-Solutions · MIT