Longest water-flow path with momentum

0
Remix

You get an m x n matrix of heights. Water starts at any cell and moves to a neighboring cell up, down, left or right. Whether it may move on depends on the heights and on the momentum it has built up on earlier steps. Return the length of the longest path it can travel.

GoogleCodingLast asked Apr 2026
No answer yet. Write the first one; the best answer gets endorsed.