Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nathanworden/e76fa1fc097c8f5f0a9b359e529b1656 to your computer and use it in GitHub Desktop.
Save nathanworden/e76fa1fc097c8f5f0a9b359e529b1656 to your computer and use it in GitHub Desktop.
Ruby Meetup
ALPHA = ('a'..'z').to_a
def missing_alphabets(s)
alpha_hash = {}
ALPHA.each {|e| alpha_hash[e] = 0}
missing = ""
s.chars.each do |char|
alpha_hash[char] += 1
end
num_alphabets = alpha_hash.values.max
alpha_hash.each do |key, value|
while value < num_alphabets
missing << key
value += 1
end
end
missing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment