Implement `nextGreaterElement(nums)` returning, for each element, the next greater value to its right, or `-1` if none, using a monotonic stack.
+ 1 hidden test run on Submit.
A monotonic stack of indices resolves each element's next-greater value in O(n) time.
Run your code to see results.