Can i know whats going wrong here?


This is the code can u plz tell what am i doing wrong?

Hey @pranjalarora98
Use an unordered map instead because you will not be using most of the space in dp array
say we have n then we go to n/2 , n/3 and n/4 so here we will not be using space from n/2+1 to n-1 ever.
So we don’t need most of the space and n can be as large as 1 000 000 000

yes that is fine but then also ans should come for 12 .right?

Let me check again :slight_smile:

You have to add this condition

if(n==0)return 0;

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.