Applications of Monotonic queue

I encountered many problems of using Monotonic queue

such as

  • Next Greater Element I
  • Next Greater Element II
  • Trapping Rain Water

They all use the monotonic queue to find a next greater element (or preceeding greater element).
Or someone says, it finds the nerest element that is {larger, smaller} to the {left, right} of a certain position given an array.

Are there any other applications of Monotonic queue other ths finding the nearest element?

Comments (2)