3744. Find Kth Character in Expanded String
You are given a string
sconsisting of one or more words separated by single spaces. Each word insconsists of lowercase English letters.We obtain the expanded string
tfromsas follows:
- For each word in
s, repeat its first character once, then its second character twice, and so on.For example, if
s = "hello world", thent = "heelllllllooooo woorrrllllddddd".You are also given an integer
k, representing a valid index of the stringt.Return the
kthcharacter of the stringt.
1 | class Solution { |