Skip to content

Instantly share code, notes, and snippets.

@rpf5573
Created February 28, 2019 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpf5573/4b1878e9ba6e000dd76f2696118ef92a to your computer and use it in GitHub Desktop.
Save rpf5573/4b1878e9ba6e000dd76f2696118ef92a to your computer and use it in GitHub Desktop.
def solution(triangle):
for i in range(len(triangle)-1, -1, -1):
for z in range(len(triangle[i]) - 1):
left = triangle[i][z]
right = triangle[i][z+1]
big = left if (left > right) else right
top = (i - 1, z)
triangle[top[0]][top[1]] = big + triangle[top[0]][top[1]]
return triangle[0][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment