Runs in IDLE not in leetcode


  • 0
    K

    class Solution(object):
    def rotate(self, nums, k):
    if nums != [] and k >0:
    x=(nums[len(nums)-k:len(nums)])
    x.reverse()
    print(x)
    for i in x:
    nums[0:0]=[i]
    nums[len(nums)-k:len(nums)]=[]
    return nums
    elif k == 0:
    return nums

    Error when
    Input: [1]
    0
    Output: Do not return anything, modify nums in-place instead.
    Expected: [1]


Log in to reply
 

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