Given an array of n distinct elements. Find the length of shortest unordered (neither increasing nor decreasing) sub array in given array.
The first line consists of an integer T i.e number of test cases. The first line of each test case consists of an integer n.The next line consists of n spaced numbers.
Print the required output.
1 <= T <= 100
1 <= n <= 100
1 <= a[i] <= 105
7 9 10 8 11
1 2 3 5
Testcase 1: Shortest unsorted subarray is 9, 10, 8 which is of 3 elements.
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.