ClassyNumbers- digit dp

What is the need for memoization in this case ?
There won’t be any overlapping sub problems…

There will be.
Assume case when you have 0s at different places.
1200
And 1020
Same case.
So we take dp on mask and location

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.

My code for the same is not working. Pls help. ide : https://ide.codingblocks.com/s/184852

Hey @aman2382000
Check this out once https://codeforces.com/blog/entry/61727

Sir I understood the concept and implemented in the same way. Just unable to find out why my code is not giving desired output. Instead it is giving 2 as result every time.

Your DP array is not reset after every time you calculate something. Reset all values to zero after that. I have the changes here https://ide.codingblocks.com/s/184953.

If your doubt is resolved please mark it as closed.