Contains Duplicate

Given an integer array nums, return true if any value appears at least twice in the array and false if every element is distinct.

Constraints

  • 1 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9
Saving… · 2 lines
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
Console

Click Run to execute sample tests.