【旋转字符串】LintCode题目地址
def rotateString(self, str, offset):
# write your code here
n = len(str)if offset < 0 or n == 0:
return str
offset = offset % ni, j = 0, len(str) - 1temp = (str + str)[n - offset : 2 * n - offset]for i in xrange(len(temp)):
str[i] = temp[i]