Simple Javascript Solution

  • 0
    var rotate = function(nums, k) {
        for (let i=0;i<k;i++){

    the compiler asks us not to return an array, otherwise we would

    return nums;

    after the for loop

Log in to reply

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