Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created September 3, 2014 14:41
Show Gist options
  • Save pumpkincouture/39c7cc39cc57a233e613 to your computer and use it in GitHub Desktop.
Save pumpkincouture/39c7cc39cc57a233e613 to your computer and use it in GitHub Desktop.
def how_many_families
list_length = @santa_list.length
family_members = @santa_list.group_by{|person| person.last }.values.select{|last_name| last_name.size >= list_length/2.0}
return true unless family_members.empty?
false
end
def print_error(boolean)
boolean = how_many_families
puts "Sorry, no combination exists." if boolean
false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment