Perfect Array
Submissions: 2949   Accuracy:

22.48%

  Difficulty: Basic   Marks: 1

There is an array contains some non-negative integers. Check whether the array is perfect or not. An array is called perfect if it is first strictly increasing, then constant and finally strictly decreasing. Any of the three parts can be empty.

Input:
The first line of the input contains an integer T, denoting number of test cases. The first line of each test case contains an integer N denoting the size of the array. The second line of each test cases N space separated integers.
Output:
For each test case, print "Yes" if it satisfies the condition else "No".

Constraints:
1<=T<=100
1<=N<=10^3
Each element in the array will be in range [1,100000]

Example:
Input:
2
6
1 8 8 8 3 2
5
1 1 2 2 1

Output:
Yes
No

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sahil Chhabra
Author: Sahil_Chhabra


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.