Rotate Array Right

Rotate array elements to the right by a specified number of positions, wrapping elements around.

Code

General
arr.rotate(-n)

Parameters

Array to rotate

Positions to rotate

Server

More Ruby Snippets