Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
log(n) (space) and o(n) (time) solution in Speedy category for Golden Pyramid by DiZ
def count_gold(pyramid):
m = [0]*(len(pyramid)+1)
for line in reversed(pyramid):
m = [v + max(m[k:k+2]) for k,v in enumerate(line)]
return m[0]
May 9, 2014
Comments: