Leetcode 3031. Minimum Time to Revert Word to Initial State II
Given a string and integer k where each second you remove the first k characters and append any k characters, find the minimum positive t so the string can return to its original form. This reduces to finding the smallest t such that the prefix of length n - t*k equals the suffix starting at t*k (i.e., a prefix-suffix overlap condition), which can be detected with linear-time string-overlap algorithms.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.