LeetCode Offer 58 II. Left shift string

algo

链接:剑指 Offer 58 - II. 左旋转字符串 - 力扣(LeetCode)

输入: s = “abcdefg”, k = 2
输出: “cdefgab”

class Solution:
  def reverseLeftWords(self, s: str, n: int) -> str:
    return s[n:] + s[:n]

Last update : May 23, 2023
Created : May 20, 2023