Hello,
I would recommend writing code. Doesn’t need to be recursive, can be solved by a simple loop.
pseudo code (main logic, you will need to implement functions and classes):
while (True):
unvisitedCells = getAdjacentUnvisitedCells(currentCell)
if (unvisitedCells.count< 1):
return
currentCell = pickCellWithHeighestValue(unvisitedCells)
currentCell.visited = True
walkedCells.append(cell)