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 greater than nums[i].

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.