左旋转字符串-python
思路:左移n位就是把前n位移动到字符串后面去
# -*- coding:utf-8 -*-
class Solution:
def LeftRotateString(self, s, n):
# write code here
return s[n:] + s[:n]
思路:左移n位就是把前n位移动到字符串后面去
# -*- coding:utf-8 -*-
class Solution:
def LeftRotateString(self, s, n):
# write code here
return s[n:] + s[:n]