Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1475. Final Prices With a Special Discount in a Shop
For each price, compute the final cost as price minus the first subsequent price to its right that is <= it (or the same price if no such element exists). This is the "next smaller-or-equal element to the right" pattern and can be solved efficiently using a monotonic stack.
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.