Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Revert Word to Initial State I

med
30 min
Try to solve the Minimum Time to Revert Word to Initial State I problem.

Statement

You are given a 00 indexed string word and an integer k.

Every second, you must perform the following operation:

  • Remove the first k characters from word.

  • Append any k lowercase English characters to the end of word.

Return the minimum time greater than 00 seconds needed for word to return to its original state.

Note: You can choose any characters to append at each step, and it is not required that they match the characters that were removed.

Constraints:

  • 1≤1 \leq word.length ≤50\leq 50

  • 1≤1 \leq k ≤\leq word.length

  • word consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Time to Revert Word to Initial State I

med
30 min
Try to solve the Minimum Time to Revert Word to Initial State I problem.

Statement

You are given a 00 indexed string word and an integer k.

Every second, you must perform the following operation:

  • Remove the first k characters from word.

  • Append any k lowercase English characters to the end of word.

Return the minimum time greater than 00 seconds needed for word to return to its original state.

Note: You can choose any characters to append at each step, and it is not required that they match the characters that were removed.

Constraints:

  • 1≤1 \leq word.length ≤50\leq 50

  • 1≤1 \leq k ≤\leq word.length

  • word consists only of lowercase English letters.