Practice Minimum Time to Revert Word to Initial State II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Time to Revert Word to Initial State II
Problem Statement
Given word and k, every second remove the first k characters and append any k characters to the end. The appended characters need not equal the removed characters, but both actions must occur each second. Return the smallest positive number of seconds after which the string can equal its original value.
Source: Minimum Time to Revert Word to Initial State II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
word = "abacaba", k = 3
2
# Example 2
word = "abacaba", k = 4
1
# Example 3
word = "abcbabcd", k = 2
4
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Time to Revert Word to Initial State II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.