Simple Python Solution


  • 0
    Y
    def rotate(self, nums, k):
            length = len(nums)
            k = k % length
            nums[0: length] = nums[length - k: length] + nums[0: length - k]

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.