Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
13-liner: scare me solution in Clear category for Halloween Monsters by przemyslaw.daniel
from collections import Counter
MONSTERS = "frankenstein ghost jack mummy skeleton vampire werewolf witch zombie"
MONSTERS = [Counter(monster) for monster in MONSTERS.split()]
def halloween_monsters(spell):
halloween, surprise = [(0, Counter(spell))], 0
while halloween:
woo_boo, spell = halloween.pop()
surprise = max(surprise, woo_boo)
for monster in MONSTERS:
if (spell - monster) + monster == spell:
halloween += [(woo_boo + 1, spell - monster)]
return surprise
Sept. 20, 2019
Comments: