Retired

String array rotation (retired)

Description:

In this kata you will be given two argments: arr which is an array that you will rotate, and k which is the number of times you need to rotate arr. One rotation of an array means taking the element at index 0 and moving it to the end of the array. After performing the rotations, return the array as a string with elements separated by spaces.

Examples:

rotate([1,2,3],2) => '3 1 2'
rotate([2,4,6,8,10,12,14],5) => '12 14 2 4 6 8 10'
rotate([],20) => ''

Additional Notes:

If k is less than a zero, return the array.

Fundamentals
Arrays
Data Types

Stats:

CreatedJun 13, 2019
Warriors Trained39
Total Skips0
Total Code Submissions112
Total Times Completed23
JavaScript Completions23
Total Stars0
% of votes with a positive feedback rating38% of 12
Total "Very Satisfied" Votes4
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes7
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • sallydabbah Avatar
  • phildinius Avatar
Ad