Created
April 29, 2015 23:30
-
-
Save laurenachoo/03f55ee314442becd956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def count_letters(strings) | |
count = Hash.new(0) | |
strings.split('').each_with_index do |string, index| | |
count[string] = index | |
end | |
count | |
end | |
puts count_letters("lighthouse in the house...") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment