class Solution:
    def shiftingLetters(self, s: str, shifts: List[List[int]]) -> str:
        tree, treeSize = [0 for _ in range(2 ** 17)], 2 ** 16
        backForth = [25, 1]
        for ls, rs, val in shifts:
            ls, rs = ls + treeSize, rs + treeSize
            while ls < rs:
                if ls & 1 == 1: tree[ls] += backForth[val]
                if rs & 1 == 0: tree[rs] += backForth[val]
                ls, rs = (ls + 1) >> 1, (rs - 1) >> 1
            if ls == rs: tree[ls] += backForth[val]
        word = list(s)
        for i in range(len(word)):
            change, start = 0, treeSize + i
            while start:
                change += tree[start]
                start >>= 1
            word[i] = chr(ord('a') + ((ord(word[i]) - ord('a') + change) % 26))
        return ''.join(word)


비재귀 세그먼트 트리를 기억하고 있는가 테스트..