#C6024. Detect Duplicates in a List
Detect Duplicates in a List
Detect Duplicates in a List
Given a list of integers, determine whether the list contains any duplicate numbers. Your task is to output True
if duplicate values are present, and False
otherwise.
The problem requires you to read input from standard input (stdin) and output the result to standard output (stdout). The input will start with an integer n indicating the number of elements in the list, followed by a line containing n space-separated integers.
Note: If the list is empty (i.e. n = 0), output False
.
inputFormat
The input consists of two lines:
- The first line contains a single integer n (n ≥ 0), representing the number of integers in the list.
- The second line contains n space-separated integers. If n is 0, the second line will be empty.
outputFormat
Output a single line containing True
if any duplicate exists in the list, otherwise output False
.
5
1 2 3 4 5
False