Running minimum or maximum [mp]
Micro pattern¶
Description¶
Maintain the best extreme observed so each new value can be evaluated immediately.
Problems¶
- 121. Best Time to Buy and Sell Stock (Top Easy)
- 155. Min Stack (Top Easy)
- 42. Trapping Rain Water (Top Hard)
- 11. Container With Most Water (Top Hard)
- 84. Largest Rectangle in Histogram (Top Hard)
- 1376. Time Needed to Inform All Employees (Graph Theory)
- 695. Max Area of Island (Graph Theory)
- 1218. Longest Arithmetic Subsequence of Given Difference (Dynamic Programming)