Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Bottom-up solution solution in Clear category for The Stones by tokyoamado
from collections import defaultdict
def stones(pile, moves):
hist = defaultdict(lambda: 1)
for t in range(pile):
hist[t] = 0 if all(hist[t - m] for m in moves) else 1
return 1 if hist[pile - 1] else 2
March 5, 2019