Challenge Complexity Sequence

Easy
33.3% 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 d1d_1 to one of lesser difficulty d2d_2, where d1>d2d_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 TT, indicating the count of scenarios to assess.
  • Following this, each scenario is described over 22 lines.
    • The first line details a single integer NN, representing the total number of challenges completed by the learners.
    • The subsequent line lists NN 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

  • 1T1001 \leq T \leq 100
  • 2N1002 \leq N \leq 100
  • 11 \leq difficulty level of each challenge 5000\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 11: 1231 \leq 2 \leq 3. The learners have tackled challenges in a strictly ascending order, validating the answer as "Yes".

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

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

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