Given an array nums, for each element return the nearest strictly greater element to its left, or -1 if none exists. Return the array of answers. The input is JSON {nums}.
Input: JSON {nums}.
Output: Array — the previous greater element for each position.
Input: {"nums":[10,4,2,20,40,12,30]}
Output: [-1,10,4,-1,-1,40,40]
Explanation: Nearest greater to the left of each.Input: {"nums":[5]}
Output: [-1]
Explanation: Nothing to the left.Input: {"nums":[1,2,3,4]}
Output: [-1,-1,-1,-1]
Explanation: Strictly increasing has none to the left.1<=n<=10^5