1427. Perform String Shifts

Problem

Given a string and a 2D shift array, apply all left/right shifts and return the resulting string.

You are given a string s and an array of shifts shift where each element is [direction, amount]:

  • direction = 0: shift left by amount
  • direction = 1: shift right by amount

Each shift is applied sequentially to the current string.

Examples
Input: ["abc",[[0,1],[1,2]]]
Output: "cab"
Hints
Related Problems

1427. Perform String Shifts

Given a string and a 2D shift array, apply all left/right shifts and return the resulting string.