Observe the moving condition of Aliban from the statement. There are limited movements available. All possible scenarios of movements-
For or only path exists to reach the destination.
For and there are possible paths.
For or there are possible paths.
For and there are possible paths.
Look into the below image for a better understanding —
Finally, iterate over all paths to calculate the score. From all scores, the maximum score will be the answer.
Analysis and solutions: link to repository.