Created
February 14, 2020 01:35
-
-
Save cryptomail/79b044de99c9093719dcbbde0374a690 to your computer and use it in GitHub Desktop.
This file contains 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
@decalpack={ | |
"a" => 6, | |
"b" => 3, | |
"c" => 3, | |
"d" => 3, | |
"e" => 3, | |
"f" => 6, | |
"g" => 3, | |
"h" => 3, | |
"i" => 6, | |
"j" => 3, | |
"k" => 3, | |
"l" => 3, | |
"m" => 3, | |
"n" => 3, | |
"o" => 6, | |
"p" => 3, | |
"q" => 3, | |
"r" => 3, | |
"s" => 3, | |
"t" => 3, | |
"u" => 6, | |
"v" => 3, | |
"w" => 3, | |
"x" => 3, | |
"y" => 3, | |
"z" => 3 | |
} | |
@lettercount = {} | |
members = ["brice", "mervyn", "vatsal", "robert", "matt", "josh", "sneha"] | |
members.each do |member| | |
member.split('').each do |c| | |
@lettercount[c] ? (@lettercount[c]=@lettercount[c] + 1) : (@lettercount[c]=1) | |
end | |
end | |
def largest_hash_key(hash) | |
hash.max_by{|k,v| v} | |
end | |
print "Highest Letter count is #{largest_hash_key @lettercount}\n" | |
@packs = 1 | |
@lettercount.each do |l,cnt| | |
targetpacks = cnt/@decalpack[l] | |
if targetpacks > @packs | |
@packs = targetpacks | |
end | |
end | |
print "We need #{@packs} packs https://www.amazon.com/Carefree-Glitter-Letters-Numbers-Transfer/dp/B07LFNGT2Y/ref=sr_1_26?keywords=iron+on+letters&qid=1581576047&sr=8-26\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment