Given a circular array nums (the element after the last is the first), return for each element the next strictly greater element when scanning circularly, or -1 if none exists. Return the array of answers. The input is JSON {nums}.
Input: JSON {nums}.
Output: Array — the next greater element for each position.
Input: {"nums":[1,2,1]}
Output: [2,-1,2]
Explanation: The last 1 wraps to the 2.Input: {"nums":[5]}
Output: [-1]
Explanation: Only element.Input: {"nums":[3,2,1]}
Output: [-1,3,3]
Explanation: Smaller elements wrap to 3.1<=n<=10^4