← Return

Left RotationEasy

A \(left rotation\) operation on a circular array shifts each of the array's elements \(1\) unit to the left. The elements that fall off the left end reappear at the right end. Given an integer \(d\), rotate the array that many steps to the left and return the result.

Example

\(d = 2\)

\(arr = [1, 2, 3, 4, 5]\)

After \(2\) rotation, \(arr^1 = [3, 4, 5, 1, 2]\).