Alice starts with word = "a". In each operation she builds a new string by changing every character of word to the next letter of the alphabet (z becomes a) and appends it to the end of word. Given a positive integer k, return the k-th character (1-indexed) of word once it has at least k characters.
Alice starts with word = "a". In each operation she builds a new string by changing every character of word to the next letter of the alphabet (z becomes a) and appends it to the end of word. Given a positive integer k, return the k-th character (1-indexed) of word once it has at least k characters.
Example 1:
Input: {"k":5}
Output: b
Constraints:
1≤k≤500
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"k":5}
Each round doubles the word: the new right half is the old word with every letter moved up by one. So word[i + 2^m] = word[i] + 1 for i < 2^m.