1427. Perform String Shifts

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1427

class Solution:
    def stringShift(self, s: str, shift: List[List[int]]) -> str:
        x = sum((b if a else -b) for a, b in shift)
        x %= len(s)
        return s[-x:] + s[:-x]