[Community Puzzle] The Hungry Duck


My code is stuck on validators 2 & 4, but I check if the duck stays in the lake, and what is the best path before taking it, so any idea why it is blocked here ?

Thanks :wink:

Consider the following input
3 3
1 2 9
3 4 8
5 6 7

1 Like

Same here it works fine in test cases 100% and i can’t know what wrong with validation test (got passed 50 %) ,i also tried vertical column 1* 10 on python idle and worked fine .

i made the code to get the only next more food, So i have to make it get the overall more food ,will try ,thanks for help

I finally found, but still don’t understand why it didn’t work the first time : try to do the path for end to beginning, and keep the highest of the two solutions, it works

So I have this totally general recursive solution in Java, and for some reason it fails on validation 3. No idea what to even look for, since it won’t even hint at what went wrong. Ideas?

:confused: Mine also fails on the n°3 validation test (‘Puddle’). I am using a recursive ‘wavefront’ solution, keeping paths in memory and eliminating suboptimal paths during the spread. ‘One line’- and ‘one column’ -ed lakes (as well as the one suggested by AIWerewolf) tested and pass…
Any ideas of how the lake n° 3 looks like?

My code does the same as yours. Runs all the test cases but fails on the official #2 and #4.