About the meaning of k


  • 0
    F

    I have got two different results which are conflicted with each other.

    if the k means that we will rotate the nums[0,k],then this may be wrong

    Input: [1,2],0
    Output: [2,1]
    Expected: [1,2]
    

    if the k means that we will totate totally k elements of the array from the begining,then this may be wrong

    Input: [1,2,3],1
    Output:[2,3,1]
    Expected:[3,1,2]
    

    So what does the k actually mean?


    here is my two different pieces of code according to the two meanings of k:
    my code


Log in to reply
 

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