Skip to main content
impol.dev

Find the K-th Character in String Game I

Easy

Alice and Bob are playing a game. Initially, Alice has a text word = "a" .

You receive a positive integer k .

Now Bob will ask Alice to perform the following operation forever:

  • Generate a new text by changing each character in word to its next character in the English alphabet, and append it to the original word .

For example, performing the operation on "c" generates "cd" and performing the operation on "zb" generates "zbac" .

Produce the value of the k^th character in word , after enough operations have been done for word to have at least k characters.

Example 1

Input: k = 5

Output: "b"

Explanation: Initially, word = "a" . We need to do the operation three times:

  • Generated string is "b", word becomes "ab".

  • Generated string is "bc", word becomes "abbc".

  • Generated string is "bccd", word becomes "abbcbccd".

Example 2

Input: k = 10

Output: "c"

Constraints

  • 1 <= k <= 500

Did this problem appear in one of your interviews?

Responses stay private.

Acceptance rate: 0%

© 2026 impol.dev. All rights reserved.PrivacyTerms