If you don't know how to solve any problem.Break into last part, base condtion at the top or bottom level how it behave then, make the recusrive function and covert into code. Use the static variables to handle the updated the values in every recursive call. Use the memorization and iterative approaches to overvcome the time commplexity of recusrive calls.