Approach hintTry it first, then revealHide
Strictly increasing moves can never form a cycle, so a memoised DFS is safe: the longest path from a cell is one plus the best result among its larger neighbours. Each cell is solved once, O(mn).
Strictly increasing moves can never form a cycle, so a memoised DFS is safe: the longest path from a cell is one plus the best result among its larger neighbours. Each cell is solved once, O(mn).