Contains Duplicate
Easy
Arrays & Hashing
GoogleAmazonApple
Given an array of integers, return true if any value appears at least twice, and false if every element is distinct.
Input: one line of space-separated integers.
Output: print "true" or "false".
Input: one line of space-separated integers.
Output: print "true" or "false".
Examples
Input:
1 2 3 1
Output:
true
Input:
1 2 3 4
Output:
false
Constraints
1 <= n <= 10^5
Sample test cases
Input
1 2 3 1
Expected output
true
Input
1 2 3 4
Expected output
false
Try solving it yourself first 💪
Write your solution in the editor, then hit “Mark solved”. In-browser run & auto-check is coming soon.