Skip to content
LEETFLIX

method

Monotonic Stack — animated LeetCode walkthroughs

LeetCode problems solved with Monotonic Stack. Browse the complete tag, then watch the algorithm move — step-by-step animation, Python and Go.

100 problems · 82 animated · 18 locked

Start with a walkthrough

Full Mono stack index

  1. 42Trapping Rain WaterWatch
  2. 84Largest Rectangle in HistogramWatch
  3. 85Maximal RectangleWatch
  4. 239Sliding Window MaximumWatch
  5. 255Verify Preorder Sequence in Binary Search TreeLocked
  6. 316Remove Duplicate LettersWatch
  7. 321Create Maximum NumberWatch
  8. 402Remove K DigitsWatch
  9. 456132 PatternWatch
  10. 496Next Greater Element IWatch
  11. 503Next Greater Element IIWatch
  12. 581Shortest Unsorted Continuous SubarrayWatch
  13. 654Maximum Binary TreeWatch
  14. 683K Empty SlotsLocked
  15. 739Daily TemperaturesWatch
  16. 768Max Chunks To Make Sorted IIWatch
  17. 769Max Chunks To Make SortedWatch
  18. 853Car FleetWatch
  19. 862Shortest Subarray with Sum at Least KWatch
  20. 901Online Stock SpanWatch
  21. 907Sum of Subarray MinimumsWatch
  22. 918Maximum Sum Circular SubarrayWatch
  23. 962Maximum Width RampWatch
  24. 975Odd Even JumpWatch
  25. 1008Construct Binary Search Tree from Preorder TraversalWatch
  26. 1019Next Greater Node In Linked ListWatch
  27. 1063Number of Valid SubarraysLocked
  28. 1081Smallest Subsequence of Distinct CharactersWatch
  29. 1124Longest Well-Performing IntervalWatch
  30. 1130Minimum Cost Tree From Leaf ValuesWatch
  31. 1425Constrained Subsequence SumWatch
  32. 1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitWatch
  33. 1475Final Prices With a Special Discount in a ShopWatch
  34. 1499Max Value of EquationWatch
  35. 1504Count Submatrices With All OnesWatch
  36. 1526Minimum Number of Increments on Subarrays to Form a Target ArrayWatch
  37. 1574Shortest Subarray to be Removed to Make Array SortedWatch
  38. 1673Find the Most Competitive SubsequenceWatch
  39. 1687Delivering Boxes from Storage to PortsWatch
  40. 1696Jump Game VIWatch
  41. 1762Buildings With an Ocean ViewLocked
  42. 1776Car Fleet IIWatch
  43. 1793Maximum Score of a Good SubarrayWatch
  44. 1856Maximum Subarray Min-ProductWatch
  45. 1944Number of Visible People in a QueueWatch
  46. 1950Maximum of Minimum Values in All SubarraysLocked
  47. 1966Binary Searchable Numbers in an Unsorted ArrayLocked
  48. 1996The Number of Weak Characters in the GameWatch
  49. 2030Smallest K-Length Subsequence With Occurrences of a LetterWatch
  50. 2071Maximum Number of Tasks You Can AssignWatch
  51. 2104Sum of Subarray RangesWatch
  52. 2281Sum of Total Strength of WizardsWatch
  53. 2282Number of People That Can Be Seen in a GridLocked
  54. 2289Steps to Make Array Non-decreasingWatch
  55. 2297Jump Game VIIILocked
  56. 2334Subarray With Elements Greater Than Varying ThresholdWatch
  57. 2345Finding the Number of Visible MountainsLocked
  58. 2355Maximum Number of Books You Can TakeLocked
  59. 2398Maximum Number of Robots Within BudgetWatch
  60. 2407Longest Increasing Subsequence IIWatch
  61. 2444Count Subarrays With Fixed BoundsWatch
  62. 2454Next Greater Element IVWatch
  63. 2487Remove Nodes From Linked ListWatch
  64. 2617Minimum Number of Visited Cells in a GridWatch
  65. 2736Maximum Sum QueriesWatch
  66. 2762Continuous SubarraysWatch
  67. 2818Apply Operations to Maximize ScoreWatch
  68. 2832Maximal Range That Each Element Is Maximum in ItLocked
  69. 2863Maximum Length of Semi-Decreasing SubarraysLocked
  70. 2865Beautiful Towers IWatch
  71. 2866Beautiful Towers IIWatch
  72. 2940Find Building Where Alice and Bob Can MeetWatch
  73. 2944Minimum Number of Coins for FruitsWatch
  74. 2945Find Maximum Non-decreasing Array LengthWatch
  75. 2969Minimum Number of Coins for Fruits IILocked
  76. 3113Find the Number of Subarrays Where Boundary Elements Are MaximumWatch
  77. 3205Maximum Array Hopping Score ILocked
  78. 3221Maximum Array Hopping Score IILocked
  79. 3229Minimum Operations to Make Array Equal to TargetWatch
  80. 3359Find Sorted Submatrices With Maximum Element at Most KLocked
  81. 3420Count Non-Decreasing Subarrays After K OperationsWatch
  82. 3430Maximum and Minimum Sums of at Most Size K SubarraysWatch
  83. 3523Make Array Non-decreasingWatch
  84. 3542Minimum Operations to Convert All Elements to ZeroWatch
  85. 3555Smallest Subarray to Sort in Every Sliding WindowLocked
  86. 3578Count Partitions With Max-Min Difference at Most KWatch
  87. 3589Count Prime-Gap Balanced SubarraysWatch
  88. 3638Maximum Balanced ShipmentsWatch
  89. 3676Count Bowl SubarraysWatch
  90. 3816Lexicographically Smallest String After Deleting Duplicate CharactersWatch
  91. 3826Minimum Partition ScoreWatch
  92. 3835Count Subarrays With Cost Less Than or Equal to KWatch
  93. 3845Maximum Subarray XOR with Bounded RangeWatch
  94. 3878Count Good SubarraysWatch
  95. 3929Minimum Partition Score IILocked
  96. 3956Maximum Sum of M Non-Overlapping Subarrays IWatch
  97. 3957Maximum Sum of M Non-Overlapping Subarrays IIWatch
  98. 4045Count Robot GroupsWatch
  99. 4054Count Shadow Pairs IWatch
  100. 4055Count Shadow Pairs IIWatch