Find the Lexicographically Smallest Valid Sequence
Greedily pick the earliest indices, using precomputed bounds that allow exact matches or one allowed mismatch.
Greedily pick the earliest indices, using precomputed bounds that allow exact matches or one allowed mismatch.