[LeetCode] 189. Rotate Array
Python
class Solution:
def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
num = len(nums)
k = k % num
nums[:] = nums[num - k:] + nums[:num - k]
댓글남기기