Arrays Left Rotation

Coding Challenge Coding Live

Some error occured while loading page for you. Please try again.

We use cookies to ensure you have the best browsing experience on our website. Please read ourcookie policyfor more information about how we use cookies.

The second line containsspace-separated integers.

Complete the functionrotLeftin the editor below. It should return the resulting array of integers.

The first line contains two space-separated integersand, the size ofand the number of left rotations you must perform.

When we performleft rotations, the array undergoes the following sequence of changes:

Print a single line ofspace-separated integers denoting the final state of the array after performingleft rotations.

Aleft rotationoperation on an array shifts each of the arrays elementsunit to the left. For example, ifleft rotations are performed on array, then the array would become.

Given an arrayofintegers and a number,, performleft rotations on the array. Return the updated array to be printed as a single line of space-separated integers.

Check out the resources on the pages right side to learn more aboutarrays. The video tutorial is by Gayle Laakmann McDowell, author of the best-selling interview bookCracking the Coding Interview.

rotLeft has the following parameter(s):

Leave a Reply