#K1221. Duplicate Number Detection
Duplicate Number Detection
Duplicate Number Detection
You are given a list of integers. Your task is to determine whether any integer appears more than once in the list. In other words, you need to check if the list contains any duplicates.
The input starts with an integer n which represents the number of elements in the list, followed by n space-separated integers. The output should be True
if there exists at least one duplicate; otherwise, it should be False
.
Note: Use efficient methods because the list can be large.
Mathematically, let \( A = [a_1, a_2, \dots, a_n] \). We need to check if there exist indices \( i \) and \( j \) (with \( i \neq j \)) such that \( a_i = a_j \).
inputFormat
The input is read from standard input (stdin). The first line contains an integer n representing the number of elements in the list. The second line contains n space-separated integers.
For example:
5 1 2 3 4 5
outputFormat
Output a single line to standard output (stdout) containing either True
if there is at least one duplicate in the list or False
otherwise.
For the sample input above, the output should be:
False## sample
5
1 2 3 4 5
False