Given an array nums, for each element return the next strictly smaller element to its right, or -1 if none exists. Return the array of answers. The input is JSON {nums}.
Input: JSON {nums}.
Output: Array — the next smaller element for each position.
Input: {"nums":[4,8,5,2,25]}
Output: [2,5,2,-1,-1]
Explanation: Nearest smaller to the right of each.Input: {"nums":[5]}
Output: [-1]
Explanation: Nothing to the right.Input: {"nums":[4,3,2,1]}
Output: [3,2,1,-1]
Explanation: Each is followed by a smaller.1<=n<=10^5