Chef Beautiful Array
Chef has given you N numbers in an array A and asks you if the array is beautiful or not.
An array is said to be beautiful if there exists at least one pair (i, j) such that
i < j and A[i] <= A[j]
If the array is beautiful then print “YES”, otherwise “NO”.
First Line contains T, the number of test cases.
Next T test cases follow.
For each test case, you are given N, the count of numbers in the array in a separate line. In the next line you are given N space separated numbers, ith number represents A[i].
For each test case print “YES” or “NO” on separate line.
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 10^5
- 1 ≤ A[i] ≤ 10^8
Input: 2 2 2 3 2 3 2 Output: YES NO
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions