Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 783 Bytes

_1427. Perform String Shifts.md

File metadata and controls

33 lines (22 loc) · 783 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : January 07, 2025

Last updated : January 07, 2025


Related Topics : Array, Math, String

Acceptance Rate : 55.65 %


Solutions

Python

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]