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`.
The next greater number of a number `x` is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next greater number. If it doesn't exist, return `-1` for this number.
### Constraints
- `1 <= nums.length <= 10^4`
- `-10^9 <= nums[i] <= 10^9`
### Input Format
A single line containing space-separated integers representing the circular array `nums`.
### Output Format
Print the space-separated next greater integers.
Sample Cases
Example 1Sample Case
Input: 1 2 1
Output: 2 -1 2
Example 2Sample Case
Input: 1 2 3 4 3
Output: 2 3 4 -1 4
Example 3Sample Case
Input: 1
Output: -1
Example 4Sample Case
Input: 1 1
Output: -1 -1
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.