Class Solution
java.lang.Object
g0801_0900.s0848_shifting_letters.Solution
848 - Shifting Letters.<p>Medium</p>
<p>You are given a string <code>s</code> of lowercase English letters and an integer array <code>shifts</code> of the same length.</p>
<p>Call the <code>shift()</code> of a letter, the next letter in the alphabet, (wrapping around so that <code>'z'</code> becomes <code>'a'</code>).</p>
<ul>
<li>For example, <code>shift('a') = 'b'</code>, <code>shift('t') = 'u'</code>, and <code>shift('z') = 'a'</code>.</li>
</ul>
<p>Now for each <code>shifts[i] = x</code>, we want to shift the first <code>i + 1</code> letters of <code>s</code>, <code>x</code> times.</p>
<p>Return <em>the final string after all such shifts to s are applied</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “abc”, shifts = [3,5,9]</p>
<p><strong>Output:</strong> “rpl”</p>
<p><strong>Explanation:</strong> We start with “abc”.</p>
<p>After shifting the first 1 letters of s by 3, we have “dbc”.</p>
<p>After shifting the first 2 letters of s by 5, we have “igc”.</p>
<p>After shifting the first 3 letters of s by 9, we have “rpl”, the answer.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “aaa”, shifts = [1,2,3]</p>
<p><strong>Output:</strong> “gfd”</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
<li><code>s</code> consists of lowercase English letters.</li>
<li><code>shifts.length == s.length</code></li>
<li><code>0 <= shifts[i] <= 10<sup>9</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
shiftingLetters
-