GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 8 June 2022

[Solution] Minimum or Maximum CodeChef Solution | CodeChef Problem Solution 2022

From a hidden array A of length N, Stack constructs an array B of length N such that:

  • For all i (1iN)Bi=max(A1,A2,,Ai) or Bi=min(A1,A2,,Ai).

For the given array B of length N, Stack wants you to check whether a possible array A exists or not.

Input Format

  • The first line of input contains a single integer T, denoting the number of test cases. The description of T test cases follow.
Solution Click Below:-  CLICK HERE


  • The first line of each test case contains an integer N - the length of the array B.
  • The second line of each test case contains N space-separated integers B1,B2,,BN representing the array B.

Output Format

For each test case, output in a single line YES if A exists, otherwise print NO.









You may print each character of the string in uppercase or lowercase (for example, the strings YESyEsyes, and yeS will all be treated as identical).

Constraints

No comments:

Post a Comment