Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First - Top down solution in Clear category for Golden Pyramid by carel.anthonissen
def count_gold(pyramid):
"""
Return max possible sum in a path from top to bottom
"""
if not pyramid: return 0
left = [row[:-1] for row in pyramid[1:]]
right = [row[1:] for row in pyramid[1:]]
return pyramid[0][0] + max(count_gold(left),count_gold(right))
Nov. 9, 2017