class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
n = 0
while n<k:
c = nums.pop()
nums.insert(0,c)
n+=1
return nums
leetcode 旋转数组 python
最新推荐文章于 2024-11-13 11:37:20 发布