6 kyu
Yes No Yes No
725 of 1,427jaels
Description:
Write a code that receives an array of numbers or strings, goes one by one through it while taking one value out, leaving one value in, taking, leaving, and back again to the beginning until all values are out.
It's like a circle of people who decide that every second person will leave it, until the last person is there. So if the last element of the array is taken, the first element that's still there, will stay.
The code returns a new re-arranged array with the taken values by their order. The first value of the initial array is always taken.
Examples:
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-> [1, 3, 5, 7, 9, 2, 6, 10, 8, 4]
arr = ['this', 'code', 'is', 'right', 'the']
-> ['this', 'is', 'the', 'right', 'code']
Algorithms
Similar Kata:
Stats:
Created | May 18, 2016 |
Published | Jun 20, 2016 |
Warriors Trained | 4609 |
Total Skips | 185 |
Total Code Submissions | 13602 |
Total Times Completed | 1427 |
JavaScript Completions | 613 |
Python Completions | 725 |
Ruby Completions | 99 |
Haskell Completions | 45 |
Total Stars | 98 |
% of votes with a positive feedback rating | 90% of 302 |
Total "Very Satisfied" Votes | 258 |
Total "Somewhat Satisfied" Votes | 29 |
Total "Not Satisfied" Votes | 15 |
Total Rank Assessments | 19 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |