Skip to content

Instantly share code, notes, and snippets.

@kushpvo
kushpvo / rotateArray.py
Created April 29, 2024 08:15
rotateArray
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: