Shifting Letters Problem
Shifting Letters Problem — ExecCode Medium DSA Practice
Solve the Shifting Letters problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given a lowercase string s and an integer array shifts of the same length, shifts[i] means every character in s[0..i] should be cyclically shifted forward by shifts[i] positions in the alphabet. Return the resulting string after applying all shifts.
Examples
Input s = "abc", shifts = [3, 5, 9]; Output "rpl". Input s = "aaa", shifts = [1, 2, 3]; Output "gfd". Input s = "az", shifts = [1, 1]; Output "ca"
Constraints
1 ≤ s.length ≤ 5×10⁴ s.length == shifts.length 0 ≤ shifts[i] ≤ 10⁹
Practice Shifting Letters free on ExecCode. Browse DSA problems, topic map, and placement guides.