don't find error


  • 0
    G

    class Solution(object):
    def rotate(self, nums, k):
    """
    :type nums: List[int]
    :type k: int
    :rtype: void Do not return anything, modify nums in-place instead.
    """
    l = len(nums)
    m = []
    t = []
    m = nums[0:l-k]
    m.reverse()
    t = nums[l-k:l]
    t.reverse()
    nums = m + t
    nums.reverse()
    return

    it points [1,2] k = 1 it return[1,2]. but i test it return [2,1]


  • 0
    C

    @Gavin09 Pls format your code.


Log in to reply
 

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