
Question Description
We have a string S of lowercase letters, and an integer array shifts.
Call the shift of a letter, the next letter in the alphabet, (wrapping around so that 'z' becomes 'a').
For example, shift('a') = 'b', shift('t') = 'u', and shift('z') = 'a'.
Now for each shifts[i] = x, we want to shift the first i+1 letters of S, x times.
Return the final string after all such shifts to S are applied.
Example 1:
1 |
Input: S = "abc", shifts = [3,5,9] |
Note:
1 <= S.length = shifts.length <= 200000 <= shifts[i] <= 10 ^ 9
Solution
Approach1 :
1 |
class { |




近期评论