Next Greater Element Ii
easy
Given a circular integer array nums (i.e., the next element of nums[nums.length - 1] is nums[0]), return the next greater number for every element in nums.
Constraints
1: 1 <= nums.length <= 10^4 2: -10^9 <= nums[i] <= 10^9
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
3
1
2
1
Sample Output
3
2
-1
2
Question Video