Created
September 3, 2014 14:41
-
-
Save pumpkincouture/39c7cc39cc57a233e613 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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