Problem 3031 · Hard

Minimum Time to Revert Word to Initial State II

Use the Z-function to test in constant time whether the word after t seconds still starts with the original word.

Open the interactive visualisation