Skip to content

Commit 969df04

Browse files
committed
2020-06-14
1 parent 196506e commit 969df04

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution(object):
2+
def stringShift(self, s, shift):
3+
"""
4+
:type s: str
5+
:type shift: List[List[int]]
6+
:rtype: str
7+
"""
8+
for d, amount in shift:
9+
if d == 0:
10+
s = s[amount:] + s[:amount]
11+
else:
12+
s = s[-amount:] + s[:-amount]
13+
14+
return s

0 commit comments

Comments
 (0)