Determine the -th character in a string built through repeated expansion rules without constructing the full string.
You are given a starting string and a sequence of expansion rules that repeatedly transform it into a much longer string. Your task is to determine the character at position in the final string.
The final string can become extremely large, so a correct solution should avoid explicitly building the entire result when possible. Instead, reason about how positions map through each expansion step and trace the query position back through the transformations until the answer is found.
Return the character that appears at the 1-indexed position after all transformations have been applied.
Example 1
Input
s = "a" operations = ["ab", "bc"] k = 2
Output
b
Explanation
After the first expansion, the string becomes "ab". The second expansion changes it according to the given rule set, and the character at position 2 is still 'b'.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.