#K32787. Non-decreasing Sequence Checker
Non-decreasing Sequence Checker
Non-decreasing Sequence Checker
You are given multiple test cases. In each test case, you are given an array of integers. Your task is to determine whether the array is a non-decreasing sequence. That is, for every consecutive pair of elements (a_i) and (a_{i+1}), it must hold that (a_i \leq a_{i+1}). Output "YES" if the array is non-decreasing and "NO" otherwise.
inputFormat
The first line contains an integer (T) denoting the number of test cases. For each test case, the first line contains an integer (N) representing the size of the array, followed by a line with (N) space-separated integers.
outputFormat
For each test case, output a single line containing "YES" if the array is non-decreasing, and "NO" otherwise.## sample
3
4
1 3 3 7
5
3 5 7 6 9
3
2 2 2
YES
NO
YES
</p>