6 kyu
Organise duplicate numbers in list
1,017 of 2,296dangerdak
Description:
Sam is an avid collector of numbers. Every time he finds a new number he throws it on the top of his number-pile. Help Sam organise his collection so he can take it to the International Number Collectors Conference in Cologne.
Given an array of numbers, your function should return an array of arrays, where each subarray contains all the duplicates of a particular number. Subarrays should be in the same order as the first occurence of the number they contain:
group([3, 2, 6, 2, 1, 3])
>>> [[3, 3], [2, 2], [6], [1]]
Assume the input is always going to be an array of numbers. If the input is an empty array, an empty array should be returned.
Arrays
Sorting
Fundamentals
Similar Kata:
Stats:
Created | Jan 22, 2017 |
Published | Feb 22, 2017 |
Warriors Trained | 4135 |
Total Skips | 520 |
Total Code Submissions | 8267 |
Total Times Completed | 2296 |
JavaScript Completions | 1017 |
PHP Completions | 187 |
Python Completions | 945 |
Ruby Completions | 201 |
Crystal Completions | 11 |
Total Stars | 79 |
% of votes with a positive feedback rating | 95% of 512 |
Total "Very Satisfied" Votes | 465 |
Total "Somewhat Satisfied" Votes | 42 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 13 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |