Cannot understand the logic
@practice_05
The logic is if the array is in increasing order then the answer would be “yes”;
else it would be “no”;
I know that. could u send me the code in python
@practice_05
Here u go.
def is_solved_in_non_decreasing_order(N, difficulties):
for i in range(1, N):
if difficulties[i] < difficulties[i - 1]:
return "No"
return "Yes"
T = int(input())
for _ in range(T):
N = int(input())
difficulties = list(map(int, input().split()))
result = is_solved_in_non_decreasing_order(N, difficulties)
print(result)