6 kyu
Simple frequency sort
2,292 of 5,545KenKamau
Description:
In this kata, you will sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value.
solve([2,3,5,3,7,9,5,3,7]) = [3,3,3,5,5,7,7,2,9]
-- We sort by highest frequency to lowest frequency.
-- If two elements have same frequency, we sort by increasing value.
More examples in test cases.
Good luck!
Please also try Simple time difference
Algorithms
Sorting
Arrays
Similar Kata:
Stats:
Created | Feb 21, 2018 |
Published | Feb 21, 2018 |
Warriors Trained | 11429 |
Total Skips | 311 |
Total Code Submissions | 22514 |
Total Times Completed | 5545 |
Python Completions | 2292 |
JavaScript Completions | 2111 |
Haskell Completions | 108 |
Ruby Completions | 218 |
Nim Completions | 10 |
C++ Completions | 319 |
Java Completions | 435 |
Rust Completions | 119 |
Clojure Completions | 24 |
Go Completions | 92 |
COBOL Completions | 6 |
λ Calculus Completions | 4 |
Total Stars | 236 |
% of votes with a positive feedback rating | 95% of 839 |
Total "Very Satisfied" Votes | 764 |
Total "Somewhat Satisfied" Votes | 60 |
Total "Not Satisfied" Votes | 15 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |