← All problems

Contains Duplicate

EasyHash Set

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

Examples

Input: nums = [1,2,3,1]
Output: true
Input: nums = [1,2,3,4]
Output: false

Hints

Solution

Language:
Loading editor…
Output0 lines
Run your code to see output here.
Click Run all tests to check your solution against 5 test cases.