My code is as follows:
def rotate(self, nums, k):
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
""" for i in range(k): temp=nums[-1] del nums[-1] nums=[temp]+nums
It runs well in my computer, but it results in a wrong answer when I submit it to leetcode with the test case:
Can anyone tell me why please?
Leetcode seems to have a lot of buggy test cases. Using print, I can see that nums is as expected. But leetcode's code has different output shown.