#C13411. Detecting Duplicates in an Array
Detecting Duplicates in an Array
Detecting Duplicates in an Array
You are given an array of integers. Your task is to determine whether the array contains any duplicate elements.
Formally, if the array is denoted as \(A = [a_1, a_2, \dots, a_n]\), you need to decide if there exist indices \(i \neq j\) such that \(a_i = a_j\). The expected time complexity is \(O(n)\) and the auxiliary space complexity is \(O(n)\).
The program should read input from standard input (stdin) and write the result to standard output (stdout).
inputFormat
The first line of input contains a single integer \(n\) which represents the number of elements in the array. The second line contains \(n\) space-separated integers representing the elements of the array.
outputFormat
Output a single line containing either True
if the array contains any duplicate elements, or False
if no duplicates are found.
0
False