I am very able to think about this problem. Please help me to How can I approach in this problem. I am finding very difficulty in it. Please tell me how to approach these kinda problems

I am very able to think about this problem.
Please help me to How can I approach in this problem.
I am finding very difficulty in it. Please tell me how to approach these kinda problems.

hello @cbcao263
your code is almost correct.

a) dont check for divisibility .
if number is not divisible take its floor value.
example-> 13/2=6

b) value of n can be upto 10^9 and we can not declare array of that big size because it will take too much memory,
so use map and top down dp.

for ur reference->

Sir How You were able to thought about this Base Case? And Can’t we declare array of that size.

just an observation

no we cannot declare that big size, it will exceed the maximum allowed memory usage

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.