Challenge Complexity Sequence

Easy
37.5% Acceptance

In our coding dojo at Codedamn, we have a group of learners tackling various challenges. Your task is to assist in evaluating whether these learners are progressing through these challenges in a sequence where the complexity either escalates or remains constant, without any decline. In simpler terms, ensure that no learner moves from a challenge of difficulty $d_1$ to one of lesser difficulty $d_2$, where $d_1 > d_2$.

Declare the outcome “Yes” if the sequence of challenge difficulties is non-descending, and “No” if otherwise.

Input Format

• The initial line will present a single integer $T$, indicating the count of scenarios to assess.
• Following this, each scenario is described over $2$ lines.
• The first line details a single integer $N$, representing the total number of challenges completed by the learners.
• The subsequent line lists $N$ integers separated by spaces, denoting the difficulty levels of the completed challenges in sequence.

Output Format

• For every scenario evaluated, respond on a new line with “Yes” if the sequence of challenge difficulties is non-descending, and “No” if it is not. The response should disregard quotation marks.

Responses can be in any mixture of uppercase and lowercase letters, with yes, YeS, and YES being considered identical.

Constraints

• $1 \leq T \leq 100$
• $2 \leq N \leq 100$
• $1 \leq$ difficulty level of each challenge $\le 5000$

Sample Test Cases and Explanations

Case #1:

Input:

4
3
1 2 3
3
1 1 2
5
100 200 300 400 350
5
1000 2000 5000 3000 1000


Output:

Yes
Yes
No
No


Explanation

Test case $1$: $1 \leq 2 \leq 3$. The learners have tackled challenges in a strictly ascending order, validating the answer as "Yes".

Test case $2$: $1 \leq 1 \leq 2$. Here, the learners have engaged with challenges in a non-descending order, justifying the answer "Yes".

Test case $3$: Given that $400 \gt 350$, the sequence illustrates learners tackling a $400$-difficulty challenge prior to a $350$-difficulty one, contradicting the non-descending order requirement, thus the answer is "No".

Test case $4$: The scenario where $5000 \gt 3000$ demonstrates learners moving from a higher to a lower difficulty challenge, breaching the non-descending sequence rule, thereby rendering the answer "No".