Question
Next Taller Signal Tower
Along a highway, signal towers have different heights. For each tower, find the first tower to its right that is strictly taller. If no taller tower exists, print
Input
The first line contains KaTeX can only parse string typed expression. For each test case, the first line contains KaTeX can only parse string typed expression. The second line contains KaTeX can only parse string typed expression integers.
Output
For each test case, print KaTeX can only parse string typed expression integers: the next greater height for each tower.
Example
Example 1:
Input
Example 2:
Input
Input
1
4
2 1 3 2Output3 3 -1 -1Example 2:
Input
1
5
5 4 3 2 1Output-1 -1 -1 -1 -1