Skip to content

Instantly share code, notes, and snippets.

@alexgriff
Created August 16, 2016 21:34
Show Gist options
  • Save alexgriff/e2d90eaa1c67fdc626fc125d421de47b to your computer and use it in GitHub Desktop.
Save alexgriff/e2d90eaa1c67fdc626fc125d421de47b to your computer and use it in GitHub Desktop.
def count_letters(sentence)
end
# count_letters("hello hi")
#=> {'h'=> 2, "e"=> 1, "l"=> 2, "o" => 1, " "=> 1, "i"=> 1}
def has_2?(collection, element)
end
# has_2?(["a", "b", "x", "a"], "a") #=> true
# has_2?(["a", "b", "x", "a"], "x") #=> false
def has_n?(collection, element, n)
end
# has_n?(["a", "b", "x", "a"], "a", 2) #=> true
# has_n?(["a", "b", "x", "a"], "a", 3) #=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment