Contains Duplicate

Easy Solved

Description

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

Input format / Clarification:

  • Line 1: JSON array of integers

Examples

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

Note:

Your program must print true or false so it can be compared with the expected output.

No submissions yet.

Discuss hash set usage, sorting approach, and time/space trade-offs.

Test Cases