← All problemsExample 1 Example 2
Problem
Contains Duplicate
Easy- arrays
- hash-table
Return true if some value shows up in nums more than once, and false if none does.
- Input
nums = [5, 8, 2, 9, 8]- Output
true- Explanation
8 appears at index 1 and again at index 4.
- Input
nums = [6, 1, 4, 7]- Output
false- Explanation
all four values are different.
Constraints:
1 <= nums.length <= 2 * 10^5-10^9 <= nums[i] <= 10^9
Tab indents. Press Esc, then Tab to leave the editor.
Ctrl or ⌘ + Enter runs the tests.
Run your code to see every test here. Nothing is submitted or recorded.