Given an array and a number
We can rotate by spots.
For example
Given:
1 2 |
|
We would get:
1 |
|
This can be done using a series of reverses.
How many calls to reverse() would you need?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let the lenght of A be l .