Find the K-th Character in String Game I

Solution Code
class Solution:
    def kthCharacter(self, k: int) -> str:
        word = "a"
        while len(word) < k:
            next_part = "".join(chr(ord(c) + 1) for c in word)
            word += next_part
        return word[k - 1]
Video GuideLeetcode Daily

Time Complexity

O(K)

Space Complexity

O(K)