Paytm Balance Next Greater Element
Paytm Balance Next Greater Element
EasyStacks50% accepted
Paytm shows next higher balance alert. For each element in nums1, find the next greater element in nums2. Elements of nums1 are a subset of nums2.
Approach
Find next greater element for each number using a monotonic stack.
Input
4
4 5 2 25
Output
5 25 25 -1
More Stacks problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards