One-Liner solution in Clear category for Golden Pyramid by
def count_gold(pyramid, pos=(0, 0)):
On the pyramid we can only make a step down or down and to the right.
We return the maximum of our both steps plus the value we are standing on.
If we cannot make a step, because we are already at the foot of the pyramid, we just return the value we are standing on.
return max(count_gold(pyramid, (pos + 1, pos)), count_gold(pyramid, (pos + 1, pos + 1))) + pyramid[pos][pos] if pos + 1 < len(pyramid) else pyramid[pos][pos]
Jan. 26, 2016