Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 496. Next Greater Element I
Given nums1 as a subset of nums2, for each element in nums1 return the first greater element that appears to its right in nums2 (or -1 if none). This is typically solved by precomputing next-greater values for nums2 using a monotonic stack to get an O(nums1.length + nums2.length) solution.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.