Shifting Letters
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Shifting a lowercase letter moves it forward in the alphabet by one, wrapping from 'z' back to 'a'.
You are given a lowercase string s and an integer array shifts of the same length. For each index i in order, shift **every one of the first i + 1 letters** of s forward by shifts[i] positions.
Return the final string after all operations have been applied. Aim for O(n) time.
Examples
Constraints
- `1 <= s.length <= 10^5`
- `s` consists of lowercase English letters
- `shifts.length == s.length`
- `0 <= shifts[i] <= 10^9`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.