Skip to content

3304. Find the K-th Character in String Game I #1882

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to find the k-th character in a string that is constructed by repeatedly performing operations where each character in the current string is replaced by its next character in the alphabet (with 'z' wrapping around to 'a'), and this new string is appended to the original string. The initial string is "a".

Approach

  1. Initialization: Start with the initial string "a".
  2. Simulation of Operations: While the length of the current string is less than k, perform the following operations:
    • Generate Next String: For each character in the current string, replace it with the next character in the alphabet ('a' follows 'z').
    • Append Next String: Append this newly generated string to the original s…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Jul 3, 2025
Maintainer Author

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jul 3, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants