Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Numbered triangles solution in Uncategorized category for Numbered Triangles by capback250
# migrated from python 2.7
from itertools import permutations, product
def checkio(chips):
possiblePlaces = []
for num, j in enumerate(permutations([list(permutations(i)) for i in chips])):
if num > 120:
break
for i in product(*j):
if all([i[x][2] == i[x+1][0] for x in range(5)]) and i[5][2] == i[0][0]:
possiblePlaces.append(i)
return max([sum([x[1] for x in x]) for x in possiblePlaces]) if possiblePlaces else 0
Dec. 28, 2015