Skip to content

189-rotate-array

DevGod
DevGod
Vtuber
/**
* @param {number[]} nums
* @param {number} k
* @return {void} Do not return anything, modify nums in-place instead.
*/
var rotate = function(nums, k) {
k = k % nums.length;
nums.unshift(...nums.splice(-k, k));
};