Problem 3291 · Medium

Minimum Number of Valid Strings to Form Target I

Mark how far each target position can reach with a valid prefix, then run a shortest-path style DP over those reaches.

Open the interactive visualisation