We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
deffind_maximum_total(triangle):n=len(triangle)foriinrange(n-2,-1,-1):forjinrange(len(triangle[i])):triangle[i][j]+=max(triangle[i+1][j],triangle[i+1][j+1])returntriangle[0][0]# Read the number of testcasest=int(input().strip())for_inrange(t):n=int(input().strip())triangle=[]for_inrange(n):row=list(map(int,input().strip().split()))triangle.append(row)result=find_maximum_total(triangle)print(result)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #67: Maximum path sum II
You are viewing a single comment's thread. Return to all comments →
Here is my Python 3 100/- Points solution