Count and Group Character Occurrences in a String

Oooh, this was a fun one…

Count and Group Character Occurrences in a String

Write a method that takes a string as an argument and groups the number of time each character appears in the string as a hash sorted by the highest number of occurrences.

The characters should be sorted alphabetically e.g:

get_char_count("cba") => {1=>["a", "b", "c"]}

I’ve been doing Javascript all day and using Ruby feels like driving a luxury automobile…

Leave a Reply