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
- 42Trapping Rain WaterWatch
- 84Largest Rectangle in HistogramWatch
- 85Maximal RectangleWatch
- 239Sliding Window MaximumWatch
- 255Verify Preorder Sequence in Binary Search TreeLocked
- 316Remove Duplicate LettersWatch
- 321Create Maximum NumberWatch
- 402Remove K DigitsWatch
- 456132 PatternWatch
- 496Next Greater Element IWatch
- 503Next Greater Element IIWatch
- 581Shortest Unsorted Continuous SubarrayWatch
- 654Maximum Binary TreeWatch
- 683K Empty SlotsLocked
- 739Daily TemperaturesWatch
- 768Max Chunks To Make Sorted IIWatch
- 769Max Chunks To Make SortedWatch
- 853Car FleetWatch
- 862Shortest Subarray with Sum at Least KWatch
- 901Online Stock SpanWatch
- 907Sum of Subarray MinimumsWatch
- 918Maximum Sum Circular SubarrayWatch
- 962Maximum Width RampWatch
- 975Odd Even JumpWatch
- 1008Construct Binary Search Tree from Preorder TraversalWatch
- 1019Next Greater Node In Linked ListWatch
- 1063Number of Valid SubarraysLocked
- 1081Smallest Subsequence of Distinct CharactersWatch
- 1124Longest Well-Performing IntervalWatch
- 1130Minimum Cost Tree From Leaf ValuesWatch
- 1425Constrained Subsequence SumWatch
- 1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitWatch
- 1475Final Prices With a Special Discount in a ShopWatch
- 1499Max Value of EquationWatch
- 1504Count Submatrices With All OnesWatch
- 1526Minimum Number of Increments on Subarrays to Form a Target ArrayWatch
- 1574Shortest Subarray to be Removed to Make Array SortedWatch
- 1673Find the Most Competitive SubsequenceWatch
- 1687Delivering Boxes from Storage to PortsWatch
- 1696Jump Game VIWatch
- 1762Buildings With an Ocean ViewLocked
- 1776Car Fleet IIWatch
- 1793Maximum Score of a Good SubarrayWatch
- 1856Maximum Subarray Min-ProductWatch
- 1944Number of Visible People in a QueueWatch
- 1950Maximum of Minimum Values in All SubarraysLocked
- 1966Binary Searchable Numbers in an Unsorted ArrayLocked
- 1996The Number of Weak Characters in the GameWatch
- 2030Smallest K-Length Subsequence With Occurrences of a LetterWatch
- 2071Maximum Number of Tasks You Can AssignWatch
- 2104Sum of Subarray RangesWatch
- 2281Sum of Total Strength of WizardsWatch
- 2282Number of People That Can Be Seen in a GridLocked
- 2289Steps to Make Array Non-decreasingWatch
- 2297Jump Game VIIILocked
- 2334Subarray With Elements Greater Than Varying ThresholdWatch
- 2345Finding the Number of Visible MountainsLocked
- 2355Maximum Number of Books You Can TakeLocked
- 2398Maximum Number of Robots Within BudgetWatch
- 2407Longest Increasing Subsequence IIWatch
- 2444Count Subarrays With Fixed BoundsWatch
- 2454Next Greater Element IVWatch
- 2487Remove Nodes From Linked ListWatch
- 2617Minimum Number of Visited Cells in a GridWatch
- 2736Maximum Sum QueriesWatch
- 2762Continuous SubarraysWatch
- 2818Apply Operations to Maximize ScoreWatch
- 2832Maximal Range That Each Element Is Maximum in ItLocked
- 2863Maximum Length of Semi-Decreasing SubarraysLocked
- 2865Beautiful Towers IWatch
- 2866Beautiful Towers IIWatch
- 2940Find Building Where Alice and Bob Can MeetWatch
- 2944Minimum Number of Coins for FruitsWatch
- 2945Find Maximum Non-decreasing Array LengthWatch
- 2969Minimum Number of Coins for Fruits IILocked
- 3113Find the Number of Subarrays Where Boundary Elements Are MaximumWatch
- 3205Maximum Array Hopping Score ILocked
- 3221Maximum Array Hopping Score IILocked
- 3229Minimum Operations to Make Array Equal to TargetWatch
- 3359Find Sorted Submatrices With Maximum Element at Most KLocked
- 3420Count Non-Decreasing Subarrays After K OperationsWatch
- 3430Maximum and Minimum Sums of at Most Size K SubarraysWatch
- 3523Make Array Non-decreasingWatch
- 3542Minimum Operations to Convert All Elements to ZeroWatch
- 3555Smallest Subarray to Sort in Every Sliding WindowLocked
- 3578Count Partitions With Max-Min Difference at Most KWatch
- 3589Count Prime-Gap Balanced SubarraysWatch
- 3638Maximum Balanced ShipmentsWatch
- 3676Count Bowl SubarraysWatch
- 3816Lexicographically Smallest String After Deleting Duplicate CharactersWatch
- 3826Minimum Partition ScoreWatch
- 3835Count Subarrays With Cost Less Than or Equal to KWatch
- 3845Maximum Subarray XOR with Bounded RangeWatch
- 3878Count Good SubarraysWatch
- 3929Minimum Partition Score IILocked
- 3956Maximum Sum of M Non-Overlapping Subarrays IWatch
- 3957Maximum Sum of M Non-Overlapping Subarrays IIWatch
- 4045Count Robot GroupsWatch
- 4054Count Shadow Pairs IWatch
- 4055Count Shadow Pairs IIWatch