| about | help | code help+videos | done | prefs |
Create a frequency map for only the consonants in a given string. To do this, use a reference string for easy look up: "bcdfghjklmnpqrstvwxyz". Your function should return an int[21] where: Index 0 is the count of 'b's Index 1 is the count of 'c's ...and index 20 is the count of 'z's. Ignore vowels (a, e, i, o, u), spaces, numbers, and case. consonantHistogram("abc") → [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] consonantHistogram("Computer language design is just like a stroll in the park. Jurassic Park, that is.") → [0, 2, 1, 0, 3, 2, 2, 3, 4, 1, 3, 3, 0, 5, 7, 6, 0, 0, 0, 0, 0] consonantHistogram("My software never has bugs. It just develops random features.") → [1, 0, 2, 2, 1, 1, 1, 0, 1, 2, 2, 1, 0, 4, 6, 4, 2, 1, 0, 1, 0] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200 Post-solution available
Copyright Nick Parlante 2017 - privacy