class Solution(object):
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: None Do not return anything, modify nums in-place instead.
"""
nums[:] = nums[len(nums) - k:] + nums[:len(nums) - k] //切成两块再重新组合
3: 旋转数组(python)
最新推荐文章于 2021-09-19 00:16:44 发布