3 line python


  • 0
    Z
    def rotate(self, nums, k):
            if k > len(nums):k = k%len(nums)
            if k == 0:return
            nums[:] = nums[-k:] + nums[:len(nums)-k]
    

Log in to reply
 

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