6 kyu
Selective Array Reversing
1,163 of 2,287kodejuice
Description:
Given an array, return the reversed version of the array (a different kind of reverse though), you reverse portions of the array, you'll be given a length argument which represents the length of each portion you are to reverse.
E.g
selReverse([1,2,3,4,5,6], 2)
//=> [2,1, 4,3, 6,5]
if after reversing some portions of the array and the length of the remaining portion in the array is not up to the length argument, just reverse them.
selReverse([2,4,6,8,10,12,14,16], 3)
//=> [6,4,2, 12,10,8, 16,14]
selReverse(array, length)
- array - array to reverse
- length - length of each portion to reverse
Note : if the length argument exceeds the array length, reverse all of them, if the length argument is zero do not reverse at all.
Algorithms
Logic
Arrays
Similar Kata:
Stats:
Created | Apr 18, 2017 |
Published | Apr 19, 2017 |
Warriors Trained | 3753 |
Total Skips | 92 |
Total Code Submissions | 8296 |
Total Times Completed | 2287 |
JavaScript Completions | 1163 |
Python Completions | 915 |
Crystal Completions | 17 |
Ruby Completions | 174 |
Groovy Completions | 59 |
Nim Completions | 21 |
Haskell Completions | 29 |
Total Stars | 64 |
% of votes with a positive feedback rating | 94% of 394 |
Total "Very Satisfied" Votes | 350 |
Total "Somewhat Satisfied" Votes | 40 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 12 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |