Most common letter

Write a method that takes in a string. Your method should return the most common letter in the array, and a count of how many times it appears.


screen-shot-2016-09-15-at-1-59-07-pm 0 sets up an empty hash.  { }

counts.max_by return the max key-value pair based on the value of “v”.

Alternative solution:

Screen Shot 2016-08-17 at 9.29.28 PM

Provided solution:


Third time doing this, I just used a hash.  Not sure if I’m using the max function correctly here:


Most common letter

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s