#K78627. Make Array Strictly Increasing

    ID: 35129 Type: Default 1000ms 256MiB

Make Array Strictly Increasing

Make Array Strictly Increasing

Given an array (a_1, a_2, \dots, a_n), determine if it is possible to make the array strictly increasing (i.e. (a_1 < a_2 < \dots < a_n)) by modifying at most one element. In other words, you are allowed to change the value of at most one element in the array to achieve the strict inequality condition. For example, for the array [3, 2, 1] the answer is NO, and for [1, 2, 3] the answer is YES.

inputFormat

The first line of input contains an integer (t), representing the number of test cases. For each test case:\

  • The first line contains an integer (n), the number of elements in the array.\
  • The second line contains (n) space-separated integers representing the array.

outputFormat

For each test case, print a single line containing YES if the array can be made strictly increasing by modifying at most one element, or NO otherwise.## sample

5
3
1 2 3
3
3 2 1
5
1 3 5 6 4
4
5 10 20 8
3
2 2 3
YES

NO YES YES YES

</p>