Monotonic Stack DSA Problems

67 monotonic stack problems for coding interviews and campus placements, with hints and company tags. Below are all 67: 2 easy, 42 medium and 23 hard. Practise them free on InternHack and track what you have solved.

Monotonic Stack problems, easiest first

  1. Final Prices With a Special Discount in a Shop (Easy)
  2. Next Greater Element I (Easy)
  3. 132 Pattern (Medium)
  4. Beautiful Towers I (Medium)
  5. Beautiful Towers II (Medium)
  6. Binary Searchable Numbers in an Unsorted Array (Medium)
  7. Buildings With an Ocean View (Medium)
  8. Car Fleet (Medium)
  9. Construct Binary Search Tree from Preorder Traversal (Medium)
  10. Count Bowl Subarrays (Medium)
  11. Count Submatrices With All Ones (Medium)
  12. Daily Temperatures (Medium)
  13. Find the Most Competitive Subsequence (Medium)
  14. Finding the Number of Visible Mountains (Medium)
  15. Jump Game VIII (Medium)
  16. Longest Well-Performing Interval (Medium)
  17. Make Array Non-decreasing (Medium)
  18. Max Chunks To Make Sorted (Medium)
  19. Maximal Range That Each Element Is Maximum in It (Medium)
  20. Maximum Array Hopping Score I (Medium)
  21. Maximum Array Hopping Score II (Medium)
  22. Maximum Balanced Shipments (Medium)
  23. Maximum Binary Tree (Medium)
  24. Maximum Length of Semi-Decreasing Subarrays (Medium)
  25. Maximum of Minimum Values in All Subarrays (Medium)
  26. Maximum Subarray Min-Product (Medium)
  27. Maximum Width Ramp (Medium)
  28. Minimum Cost Tree From Leaf Values (Medium)
  29. Minimum Operations to Convert All Elements to Zero (Medium)
  30. Next Greater Element II (Medium)
  31. Next Greater Node In Linked List (Medium)
  32. Number of People That Can Be Seen in a Grid (Medium)
  33. Online Stock Span (Medium)
  34. Remove Duplicate Letters (Medium)
  35. Remove K Digits (Medium)
  36. Remove Nodes From Linked List (Medium)
  37. Shortest Subarray to be Removed to Make Array Sorted (Medium)
  38. Shortest Unsorted Continuous Subarray (Medium)
  39. Smallest Subsequence of Distinct Characters (Medium)
  40. Steps to Make Array Non-decreasing (Medium)
  41. Sum of Subarray Minimums (Medium)
  42. Sum of Subarray Ranges (Medium)
  43. The Number of Weak Characters in the Game (Medium)
  44. Verify Preorder Sequence in Binary Search Tree (Medium)
  45. Apply Operations to Maximize Score (Hard)
  46. Car Fleet II (Hard)
  47. Count Non-Decreasing Subarrays After K Operations (Hard)
  48. Create Maximum Number (Hard)
  49. Find Building Where Alice and Bob Can Meet (Hard)
  50. Find Maximum Non-decreasing Array Length (Hard)
  51. Find the Number of Subarrays Where Boundary Elements Are Maximum (Hard)
  52. Largest Rectangle in Histogram (Hard)
  53. Lexicographically Smallest String After Deleting Duplicate Characters (Hard)
  54. Max Chunks To Make Sorted II (Hard)
  55. Maximal Rectangle (Hard)
  56. Maximum Number of Books You Can Take (Hard)
  57. Maximum Score of a Good Subarray (Hard)
  58. Minimum Number of Increments on Subarrays to Form a Target Array (Hard)
  59. Minimum Number of Visited Cells in a Grid (Hard)
  60. Minimum Operations to Make Array Equal to Target (Hard)
  61. Number of Valid Subarrays (Hard)
  62. Number of Visible People in a Queue (Hard)
  63. Odd Even Jump (Hard)
  64. Smallest K-Length Subsequence With Occurrences of a Letter (Hard)
  65. Subarray With Elements Greater Than Varying Threshold (Hard)
  66. Sum of Total Strength of Wizards (Hard)
  67. Trapping Rain Water (Hard)

Companies that ask monotonic stack problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics