practice-problems-1/no_comments/11-most-common-letter.rb
# 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.
#
# Difficulty: medium.
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.

medium.
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 . medium .
def most_common_letter(string)
  count = 0
  letter = ""
  for i in string.split('')
      if string.count(i) > count
          letter = i
          count = string.count(i)
      end
  end
  return [letter,count]
end
def most_common_letter ( string ) count = 0 letter = "" for i in string . split ( '' ) if string . count ( i ) > count letter = i count = string . count ( i ) end end return [ letter , count ] end
Write a method that takes in a string.
Write a method that takes in a string .
string
<not_specific>