简单易懂的解法:把两个s拼起来,然后从第n%len(s)开始取出len(s)个元素,就可以了 class Solution: def LeftRotateString(self, s, n): # write code here if s == None or s == "": return "" len_s = len(s) s = s + s n = n%len_s return s[n:n+len_s]