Problem 3302 · Medium

Find the Lexicographically Smallest Valid Sequence

Greedily pick the earliest indices, using precomputed bounds that allow exact matches or one allowed mismatch.

Open the interactive visualisation