[Community Puzzle] The hungry duck - part 2

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Hello there,
I’m trying to solve the hungry duck puzzle. The Way to go would be to check whether the value right is higher than the value beneath the current position and then move to the higher value field or if even, move where it can (right or bottom your pref.). Some people claim that this solution would have given them a 100% score.
(I don’t know if I am allowed to post a link to the solution. If I am, I can edit it in.)

My problem is doing it like that can’t be right imo.
Consider following inputs:

934  
215  
786 --> 9+2+7+8+6 = 32 > 9+3+4+5+6
922
182
923 --> 9+1+9+2+3 = 24 > 9+2+8+2+3
129
347
658 --> 1+2+9+7+8 = 27 > 1+3+6+5+8

checking whether right or bottom is higher and move there would not return the highest amount of food. I tried to visualize that.

So my second thought was: Well then. just move to the row with the highest sum, take all numbers on that row and then (if not already at) go straight to the end.

The last of the examples also denies this attempt.

So is the only possible way, to try every possible way?
Is my thought process flawed ?

There is a better way involving dynamic programming - hint: you are close, but you start at the wrong place.
You could bruteforce the small problem and then have a look at the solutions shared by others to solve the bigger one.

Oh my god, thank you !
I was too obsessed with the start top right thingy. Starting at the end makes much more sense.

My approach was to find all the possible paths then add up the individual scores for each path and find the max score. This approach worked for all the test samples but not for #2 and #4 in the final test.