word of lowercase English letters and a list of rolls rolls, where rolls[i] = [start, end, direction]. Each roll moves every letter from position start to position end, inclusive, by one letter: forward through the alphabet if direction = 1, backward if direction = 0.
The alphabet wraps around: 'a' follows 'z', and 'z' comes before 'a'.
Apply all the rolls and return the resulting string.word='cat', rolls=[[0, 2, 1], [1, 1, 0]] → 'dau'
First all three letters move forward: "dbu". Then the middle one moves back: "dau".
word='az', rolls=[[0, 0, 0], [1, 1, 1]] → 'za'
'a' moves back and wraps to 'z', while 'z' moves forward and wraps to 'a': "za".
word='abc', rolls=[[0, 1, 1], [0, 1, 0]] → 'abc'
A forward and a backward roll over the same stretch cancel out, so the string stays the same.
word.length, rolls.length ≤ 5·10⁴rolls[i].length == 3start ≤ end < word.lengthdirection is 0 or 1word consists of lowercase English lettersword='cat', rolls=[[0, 2, 1], [1, 1, 0]]
'dau'
Run checks the first 3 tests in your browser. Submit checks all 93 tests on the server, hidden ones included.