Time Complexity

Could you please explain how we are determining O(TN) what is T here and N here . I followed the approach
but did not follow the time complexity

In top down approach , at each level or each you are making two recursive calls , so at every level there will be 2 raise to power level call , so for n level the complexity will be O(2^n).
But if you use memoization then you dp state only depend on two factors , first position and last position ,
So your complexity will goes O(n^2).

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.