Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Counter = Multiset solution in Clear category for Halloween Monsters by juestr
from collections import Counter
MONSTERS = [Counter(m) for m
in 'skeleton ghost jack vampire witch mummy zombie werewolf frankenstein'.split()]
def halloween_monsters(spell: str)-> int:
def summon(spell, n=0):
yield n
for m in MONSTERS:
if all(m[c] <= spell[c] for c in m):
yield from summon(spell - m, n + 1)
return max(summon(Counter(spell)))
Oct. 17, 2019