In Single File (retired)
Description:
Do you remember stand in single file in gym class at school?
The first element should be placed last. And so on until again the first was the first again.
Now think of an array whit elements.
The first element of the array becomes the last one and the others are moved one index to the left.
This operation is repeated until before the array returns to its original position.
For this kata you will receive an array.
Returns a two-dimensional array whose elements are arrays, each with one rotation of the original array, starting with the original array until the one in which the first element occupies index 1.
It might be easier to look at the examples.
EXAMPLES:
const rotate = [0, 1, 2] => [ [0, 1, 2], [1, 2, 0], [2, 0, 1] ]
const rotate => ['a', 'b', 'c'] => [ ['a', 'b', 'c'], ['b', 'c', 'a'], ['c', 'a', 'b'] ]
You can do it!
Similar Kata:
Stats:
Created | May 31, 2023 |
Warriors Trained | 15 |
Total Skips | 0 |
Total Code Submissions | 31 |
Total Times Completed | 12 |
JavaScript Completions | 12 |
Total Stars | 0 |
% of votes with a positive feedback rating | 36% of 7 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 7 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |