Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Golden Pyramid by TovarischZhukov
# migrated from python 2.7
def count_gold(pyramid):
retval={0:[pyramid[0][0]]}
for elem in pyramid[1:]:
new_retval = {}
for j, val in enumerate(elem):
if j not in new_retval:
new_retval[j]=[]
if j:
for k in retval[j-1]:
new_retval[j].append(k+val)
if j in retval:
for k in retval[j]:
new_retval[j].append(k+val)
retval=new_retval
return max(max(list(retval.values()), key = max))
Dec. 14, 2015