Problem 2407 · Hard

Longest Increasing Subsequence II

For each value, the best run ending just below it within k is a range maximum over values, kept in a segment tree.

Open the interactive visualisation