I guess the reccurance is correct ? how to handle such big no i mean dp space

Hey @talhashamim001
You’re getting a tle because an array/vector can have a maximum size of 1000000, so you can’t make dp table of size > 1000000. There’s a way to tackle this, by making dp table of size 1000000 only, and handling bigger numbers using certain recursion, refer to the following code:

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.