Next Greater Element Finder

Given an array of integers nums, return an array answer such that answer[i] is the next greater element for nums[i] in nums. If there is no greater element, put -1.

The "next greater element" for an element nums[i] is the first element to the right of nums[i] that is strictly greater than nums[i]. Elements equal to nums[i] do not qualify, so a run of equal values never answers itself; when nothing to the right is strictly larger, the answer is -1.

Examples
Input: [2,1,2,4,3]
Output: [4,2,4,-1,-1]
Hints

Next Greater Element Finder

Given an array of integers `nums`, return an array `answer` such that `answer[i]` is the next greater element for `nums[i]` in `nums`. If there is no greater element, put `-1`.