Deviopath › JavaScript

Rotate an Array

Medium · Arrays

Write a function rotateRight that returns a new array where every element moved k steps to the right. Elements that fall off the end wrap around to the start.

k can be larger than the array length.

Next: String Compression