I’ve been trying to understand the issue of sumtrian problem. I reread the problem, however i’m unable to understand the relation between the input and the output.
Plz someone explain me the scenario. The problem link is given below.
Basically we are trying to figure out the path from top row to the bottom row such that the sum of numbers along this path is maximum(Keeping in mind the conditions remains satisfied, move down or down right). Rather than to print the path, here it is asked to just output the sum of numbers along this path.
for example ::
1
2 1
1 2 3
Here the possible paths from top to bottom along with their sum are 1-2-1(4), 1-2-2(5), 1-1-2(4), 1-1-3(5). Among the given options we will be outputting to the user the max value i.e. 5.
Detailed explanation of the DP used here is given in the link .