Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
DP solution in Clear category for Golden Pyramid by gyahun_dash
from functools import reduce
def sum_triangle(top, left, right):
return top + max(left, right)
def integrate(lowerline, upperline):
return list(map(sum_triangle, upperline, lowerline, lowerline[1:]))
def count_gold(pyramid):
return reduce(integrate, reversed(pyramid)).pop()
July 13, 2014
Comments: