Dashboard
LC #217
Contains Duplicate
Pattern · ?AmazonAppleGoogleMicrosoft
Problem
Given an integer array nums, return true if any value appears at least twice, or false if every element is distinct.
Constraints
- 1 ≤ nums.length ≤ 10⁵
- -10⁹ ≤ nums[i] ≤ 10⁹
Example
- Input
- nums = [1, 2, 3, 1]
- Output
- true
- Why
- 1 appears at index 0 and index 3
Spot the pattern
Which pattern cracks it?
Hints
One at a time