this is done same as hint video in recurstion section even though i am getting tle and 1 correct abswer .
Is this approach correct ? i am getting tle
Hi @Rahulkr102
The approach that is used in the video is correct for smaller inputs but on large inputs it will give TLE as it is a recursive solution and has many over lapping sub problems. Try to think of bottom up dp approach. Then you wont get TLE.
https://ide.codingblocks.com/s/165945 please read it carefully sir and tell me, is my approach correct as taught in video of bhaiya… especially the parameter passed and input of taking n and m.
Yes your approach and your code is correct but as i told you it wont work for large values of n and m and test cases.
@Aayush I would suggest you to attempt this question only after completing the Dynamic Programming Section of your course. Since the test case are large…recursive solution will fail and will give Time Limit Error.
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.