This problem requires us to think sequentially.
Let us state the facts : - We must go from the top left corner to the bottom right corner . - We can only move right or down.
You may think that this question is dreadfully complicated as there are 2^(m+n-2) ways to go from the top left corner to the bottom right. If we check every possible path to find the path in which Captain Shan and his gang encounter the most mystical treasures the time take will be way too high and we will clearly get TLE for larger m and n.
Kolwdfurr_Rad $$$a=b$$$ a=b