FunctionRacerProblemsRace

Shifting Letters

EasyArraysPython, JavaScript, TypeScript, Java, C++

Shifting a letter means replacing it with the next letter of the alphabet, and z wraps around to a. Given a string s and a list shifts of the same length, for each index i shift the first i + 1 letters of s by shifts[i] steps. So letter number j is shifted by shifts[j] + shifts[j+1] + ... up to the end of the list.

Return the final string.

Example 1

s "abc"
shifts [3,5,9]
returns "rpl"

a moves 17, b moves 14, c moves 9: rpl.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Arrays problems