Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Numbered Triangles by altarfinch
import itertools
def getMax(start,end,chips):
m0 = 0
for i, chip in enumerate(chips):
for c in itertools.permutations(chip):
if c[0] == end and (len(chips) == 1 and c[1] == start or len(chips) != 1):
m1 = getMax(start,c[1],chips[:i]+chips[i+1:])
if m1 != 0 or len(chips) == 1:
m0 = max(m0, c[2] + m1)
return m0
def checkio(chips):
return max([getMax(c,c,chips) for c in chips[0]])
Oct. 25, 2013