#C8373. Duplicate Pair Finder

    ID: 52348 Type: Default 1000ms 256MiB

Duplicate Pair Finder

Duplicate Pair Finder

You are given an integer t representing the number of test cases. For each test case, you are given an integer n and an array of n integers. Your task is to determine if there exists a pair of indices \(i, j\) such that \(0 \le i < j < n\) and \(a_i = a_j\). In other words, check whether the array contains any duplicate element.

If a duplicate exists, print YES; otherwise, print NO for that test case.

Note: The input is read from stdin and the output is written to stdout.

inputFormat

The first line contains an integer t, representing the number of test cases. Each test case consists of two lines: the first line contains a single integer n (the size of the array), and the second line contains n space-separated integers representing the array elements.

Example:

1
5
1 2 3 4 5

outputFormat

For each test case, output a single line containing YES if a duplicate pair exists, otherwise output NO.

Example:

NO
## sample
1
5
1 2 3 4 5
NO

</p>