#K43862. Determine if Array Can be Sorted
Determine if Array Can be Sorted
Determine if Array Can be Sorted
You are given T test cases. In each test case, you are given an integer N and an array A of N integers. You are allowed to perform certain operations (not explicitly defined) to try to sort the array in non-decreasing order. It turns out that the array can be sorted if and only if all its elements are distinct. In other words, an array is sortable if and only if [ N = |{a_1, a_2, \dots, a_N}|, ] where (|{a_1, a_2, \dots, a_N}|) is the number of unique elements in the array.
For each test case, output "YES" if the array can be sorted, and "NO" otherwise.
inputFormat
The input is read from standard input (stdin). The first line contains an integer T, the number of test cases. Each test case consists of two lines. The first line of a test case contains an integer N, the number of elements in the array. The second line contains N space-separated integers representing the elements of the array.
outputFormat
For each test case, output a single line containing either "YES" or "NO" (without quotes) on standard output (stdout).## sample
2
5
4 3 2 5 1
4
2 2 1 1
YES
NO
</p>