5 kyu
uniq -c (UNIX style)
469 of 855x-way
Description:
Implement a function which behaves like the 'uniq -c' command in UNIX.
It takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance together with the number of times a duplicate elements occurred in the original array.
Example:
['a','a','b','b','c','a','b','c'] --> [['a',2],['b',2],['c',1],['a',1],['b',1],['c',1]]
Arrays
Algorithms
Similar Kata:
Stats:
Created | Sep 2, 2013 |
Published | Sep 2, 2013 |
Warriors Trained | 1357 |
Total Skips | 91 |
Total Code Submissions | 5116 |
Total Times Completed | 855 |
JavaScript Completions | 469 |
Python Completions | 399 |
Total Stars | 26 |
% of votes with a positive feedback rating | 89% of 216 |
Total "Very Satisfied" Votes | 175 |
Total "Somewhat Satisfied" Votes | 33 |
Total "Not Satisfied" Votes | 7 |