Monotonic Stack
单调栈:
上一个更大(小)元素
下一个更大(小)元素
Basic Applications
- 739.Daily Temperatures
- 1475.Final Prices With a Special Discount in a Shop
- 496.Next Greater Element I
- 503.Next Greater Element II
- 1019.Next Greater Node In Linked List
- 962.Maximum Width Ramp
- 853.Car Fleet
- 901.Online Stock Span
- 1124.Longest Well-Performing Interval
- 1793.Maximum Score of a Good Subarray
- 456.132 Pattern
- 3113.Number of Subarrays Where Boundary Element is Maximum
- 2866.Beauty Towers II
- 1944.Number of Visible People in a Queue
- 2454.Next Greater Element IV
- 1130.Minimum Cost Tree From Leaf Values
- 2289.Steps to Make Array Non-Decreasing
- 1776.Car Fleet II
- 3221.Maximum Jump Array Score II (Premium)
- 1966.Numbers in Unsorted Array That Can Be Binary Searched (Premium)
- 2832.Maximum Range Where Element is Maximum (Premium)
Rectangle Area
- 84.Largest Rectangle in Histogram
- 1793.Maximum Score of a Good Subarray
- 85.Maximal Rectangle
- 1504.Count Submatrices With All Ones
- 42.Trapping Rain Water
- 755.Pour Water (Premium)
Contribution Method
- 907.Sum of Subarray Minimums
- 2104.Sum of Subarray Ranges (Max - Min)
- 1856.Maximum Subarray Min-Product
- 2818.Operations to Maximize Score
- 2281.Sum of Total Strength of Wizards (Min × Sum)
Lexicographically Smallest
- 402.Remove K Digits
- 1673.Find the Most Competitive Subsequence
- 316.Remove Duplicate Letters
- 316 Extension: Limit on Duplicate Count
- 1081.Smallest Subsequence of Distinct Characters
- 321.Create Maximum Number
- 2030.Smallest Subsequence of Distinct Characters with Specific Letter