[font=Arial, Helvetica, sans-serif][size=4]Imagine you have a row of numbers like below(a triangle). By starting at the top of the triangle, find the maximum number in each line and sum them up. Example below.[/size][/font][font=Arial, Helvetica, sans-serif][size=4]
[/size][/font][font=Arial, Helvetica, sans-serif][size=4][color=#222222][font=Calibri, sans-serif][size=2][b][size=3]5
9[/size][/b][size=3] 6
4 6 8
0 7 1 5[/size][/size][/font][/color]
[color=#222222][font=Calibri, sans-serif][size=2][size=3] [/size][/size][/font][/color]
[color=#222222][font=Calibri, sans-serif][size=2][size=3]Answer I.e. 5 + 9 +8 + 7 = 29.[/size][/size][/font][/color]
[color=#222222][font=Calibri, sans-serif][size=2]
[/size][/font][/color]
[/size][/font][font=Arial, Helvetica, sans-serif][size=4]Write a code to find the maximum total from top to bottom. Assume triangle can have at most 100000 rows. [/size][/font]
[font="Arial, Helvetica, sans-serif"][size=4]
[/size][/font]
[font="Arial, Helvetica, sans-serif"][size=4]Please Help…![/size][/font]
[font="Arial, Helvetica, sans-serif"][size=4]
[/size][/font]
[font="Arial, Helvetica, sans-serif"][size=4]
[/size][/font]
[font=Arial, Helvetica, sans-serif][size=4]
[/size][/font]