Python Beginner tutorial series using project Euler #18 - Maximum path sum 1

preview_player
Показать описание
Problem 18 where I show how to solve the maximum path sum in a cleverer way than just a simple brute force attack, where we 'shrink' the triangle down step by step. I do have something else planned for scraping the triangle data from the web but that will come in a later video, unsure exactly when this will be though so keep a lookout if you're interested.

Please don't forget to like if you liked the video and subscribe if you want to see more, thanks!

Рекомендации по теме
Комментарии
Автор

You can put the triangle in string called "bad" then do this to make a list of list


a = bad.split("\n")
new = [ ]
for i in a:
b = i.split(" ")
new.append(b)

for i in new:
print (i)

pragyan
Автор

I didn't get it....they said that we have to go through the adjacent element of every row...not by the maximum element if it is....so can u please tell on how to count rows so that I could iterate through every row and find the max element and add them up to get the max path...I mean the easy way. ....please....its hard for me to get through these Rowe logic....I hope u reply....😇😇😇

Shelly-sr
Автор

Thanks for the video ! it has been super helpful. :) This is an exercise for the ICS I am taking and the professor did not explain well. Do you think this can be done via recursion? Thanks!

freyayao
visit shbcf.ru