#K88302. Contains Duplicate
Contains Duplicate
Contains Duplicate
Given an integer array \(nums\) of length \(n\), determine whether any integer appears at least twice in the array. In other words, if any element appears more than once, the output should be true
; otherwise, output false
.
Example: For the array [1, 2, 3, 1], since the number 1 appears twice, the correct output is true
.
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
- The first line contains a single integer \(n\), denoting the number of elements in the array.
- If \(n > 0\), the second line contains \(n\) space-separated integers representing the array elements.
outputFormat
The output should be printed to standard output (stdout). It is a single line which is true
if any integer appears at least twice in the array, or false
if every element is unique.
4
1 2 3 1
true