1. Postorder Merge

    postorder merge instead of building the result, as we go down, we build it POST order as in after the rec step this is very similar to DP except since you are only dependent on children states you usually optimise globally and return NEEDED state problems maximum path sum on a binary tree f(u) → max...

  2. Base Monotonic Deque

    Base Monotonic Deque When To Use Use this when you need the best max/min candidate among active indices. The deque stores indices.

  3. Base Monotonic Stack

    Base Mono Stack When To Use Use this when each index needs the nearest greater/smaller element on one side.

  4. DP Window Optimisation

    DP Window Optimisation When To Use Use this when a DP transition asks for min or max over a moving valid range.

  5. Fixed Window Extrema

    Fixed Window Extrema When To Use Use this when every query is over a fixed-size window and you need the max or min.

  6. Prefix Sum Candidates

    Prefix Sum Candidates When To Use Use this when candidates are prefix indices and the deque keeps the best prefix sums.

  7. Variable Window Max Min

    Variable Window Max Min When To Use Use this when a variable-size window is valid based on the current max and min.

  8. Contribution by Boundary

    Contribution By Boundary When To Use Use this when summing over all subarrays and each element contributes as the minimum or maximum over some range.

  9. Farthest Candidate Stack

    Farthest Candidate Stack When To Use Use this when you need the farthest valid index, not the nearest greater/smaller index.

  10. Greedy Remove Stack

    Greedy Remove Stack When To Use Use this when building a lexicographically smallest/largest subsequence while you are allowed to drop elements.