#C13704. Detect Duplicates in a List
Detect Duplicates in a List
Detect Duplicates in a List
Given a sequence of integers, your task is to determine if the list contains any duplicate values. In other words, if any number appears at least twice, print True
; otherwise, print False
.
Efficiency matters, so consider optimal techniques when checking for duplicates.
For example, using a set to track seen numbers is an effective approach.
inputFormat
The first line contains a single integer \(n\), representing the number of elements in the sequence.
The second line contains \(n\) space-separated integers.
outputFormat
Output a single line with True
if there exists at least one duplicate in the sequence, or False
if all elements are distinct.
5
1 2 3 4 5
False