1427. Perform String Shifts
All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : January 07, 2025
Last updated : January 07, 2025
Related Topics : Array, Math, String
Acceptance Rate : 55.65 %
class Solution:
def stringShift(self, s: str, shift: List[List[int]]) -> str:
x = (sum([-x[1] if x[0] else x[1] for x in shift]) + len(s)) % len(s)
return s[x:] + s[:x]