Two-line javascript solution


  • 0
    H

    var rotate = function(nums, k) {

    k %= nums.length;
    [].unshift.apply(nums, nums.splice(nums.length - k, k));
    

    };


Log in to reply
 

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