sir my code is working up to a limit what is the problem in my code
Tilling problem
hey @pankajsingh for the given constraints recursion will give you time limit exceed you have to use dp instead of recursion. if you get problem in making dp logic you can ask me.
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.
please provide soln of this problem
@pankajsingh
We cannot provide solution to problems. Try solving it on your own and ask for help if you face any kind of trouble.
As I can see you have written a recursive solution. Try using memoization to improve your time complexity. If you face any problems , discuss here.
atleast check my code
atleast check my code
- Use long long int instead of int.
- Take mod during the computations as well and not just at the end.
- Declare your dp array in global statically.