#K55702. Check if an Array is Sorted in Non-Decreasing Order
Check if an Array is Sorted in Non-Decreasing Order
Check if an Array is Sorted in Non-Decreasing Order
You are given several arrays, and your task is to determine for each array whether it is sorted in non-decreasing order. An array ( a_1, a_2, \dots, a_N ) is considered sorted in non-decreasing order if for every ( i ) (( 1 \le i < N )), the condition ( a_i \le a_{i+1} ) holds. For each test case, output "Yes" if the array meets the requirement, or "No" otherwise.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer ( T ) representing the number of test cases.
- For each test case:
- The first line contains an integer ( N ), the number of elements in the array.
- The second line contains ( N ) space-separated integers.
For example:
3 4 1 2 3 4 3 1 3 2 5 2 2 2 2 2
outputFormat
For each test case, output on a new line either "Yes" if the corresponding array is sorted in non-decreasing order, or "No" otherwise. The output is printed to standard output (stdout).## sample
3
4
1 2 3 4
3
1 3 2
5
2 2 2 2 2
Yes
No
Yes
</p>