Given an unsorted array. The task is to find all the star and super star elements in the array. Star are those elements which are strictly greater than all the elements on its right side. Super star are those elements which are strictly greater than all the elements on its left and right side.
Note: Assume first element (A) is greater than all the elements on its left side, And last element (A[n-1]) is greater than all the elements on its right side.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains an Integer N denoting size of array and the second line contains N space separated elements.
For each test case, print the space separated star elements and then in new line print super star elements. If no super star element present in array then print "-1".
4 2 5 7 2 1
8 6 5
7 2 1
8 6 5
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.