Intermediate Monotonic Stack Problems for Coding Interviews
9 intermediate Monotonic Stack problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 9 intermediate and 0 advanced. The companies that ask them most often are Amazon, Bloomberg, Google, Microsoft.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Next Greater Value (Intermediate)
- Daily Temperatures (Intermediate)
- Remove K Digits to Get the Smallest Number (Intermediate)
- Circular Next Greater Value (Intermediate)
- Largest All-Ones Rectangle (Intermediate)
- Next Greater Node in Linked List (Intermediate)
- Next Greater Element Distance Sum (Intermediate)
- Stern-Brocot Path of Fraction (Intermediate)
- Next Greater Element Queries (Intermediate)
Related
Frequently asked questions
How do I get good at monotonic stack problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run monotonic stack problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.