harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-6611harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-6611One day, Prof. Slim decided to leave the Kingdom of GUC to join the Kingdom of GIU. Before he could join, he was given an online assessment to complete. However, citizens of GUC, wanting him to stay, hacked the assessment and made it more challenging.
Your task is to determine if a given array of integers can be sorted in non-decreasing order by performing a series of operations. The allowed operation is as follows:
For example, if you select ( a_i = 3 ) and ( a_j = -2 ), they will change as follows:
Note: It is guaranteed that the sum of ( n ) over all test cases does not exceed ( 10^5 ).
For each test case, print "YES" if the array can be sorted in non-decreasing order, otherwise print "NO". You can output each letter in any case (upper or lower).
4
7
7 3 2 -11 -13 -17 -23
6
4 10 25 47 71 96
6
71 -35 7 -4 -11 -25
6
-45 9 -48 -67 -55 7
NO
YES
YES
NO
Implement your solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.