3031. Minimum Time to Revert Word to Initial State II
python
class Solution:
def minimumTimeToInitialState(self, word: str, k: int) -> int:
for i in range(k,len(word),k):
if word.startswith(word[i:]):return int(i/k)
return ceil(len(word)/k)
其实如果找到前缀任务就完成了
思维题