#3307
Find the K-th Character in String Game II
candidate master · 1470 · lc hard +32 · 48.5% accepted · 525 likes · top 34%
Description
Alice and Bob play a game. Alice starts with word = "a". You are given positive integer k and integer array operations. Bob asks Alice to apply each operation:
- operations[i] == 0: append a copy of word to itself.
- operations[i] == 1: increment each character cyclically, then append the result.
Return the k-th character of word after all operations ('z' wraps to 'a').
Code
1
2
3