# -*- coding:utf-8 -*-classSolution:defLeftRotateString(self, s, n):# write code hereifnot s or n >len(s):return""return s[n:]+s[:n]if __name__ =='__main__':
test ='abcdefg'
s = Solution()print(s.LeftRotateString(test,len(test)))
左旋转字符串题目解法解法1 利用python切片特点题目左旋转字符串解法解法1 利用python切片特点# -*- coding:utf-8 -*-class Solution: def LeftRotateString(self, s, n): # write code here if not s or n > len(s): ...