code: https://ide.codingblocks.com/s/428642
prob: https://hack.codingblocks.com/app/contests/2022/128/problem
getting the correct answer for sample test case
code: https://ide.codingblocks.com/s/428642
prob: https://hack.codingblocks.com/app/contests/2022/128/problem
getting the correct answer for sample test case
hello @raghav007
the process is recursive i.e you can furthur divide the obtained coins if u want.
IN math terms->
f(n)= max ( n , f(n/2) + f(n/3) + f(n/4) )
I made a recursive function and applied dp but it is giving run error
check value of n . it can be upto 10^9.
use map in place of array for memoisation
it is giving answer as 0
check now-<
it is showing wrong ans for 1 tc
use long long for value of map as well.
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.