Binary Search, DFS and DP

174. Dungeon Game

The naively DFS solution gets TLE as each position we have two choices and it will make the complexity exponential.

The modified maximum path and binary search work pretty good.

Actually, we can use a simple DP to solve this problem. The solution is shown HERE.

Python version is here:

Data Scientist/MLE/SWE @takemobi