This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def rotate(self, nums: List[int], k: int) -> None: | |
""" | |
Do not return anything, modify nums in-place instead. | |
""" | |
k = k % len(nums) | |
# Reversing the whole array 12345 -> 54321 | |
l, r = 0, len(nums) - 1 | |
while l < r: |