Exchanging coins doubt
1 test case is showing timelimit
@gauravmadan583 You are using 2 loops, try doing it with a single loop.
Something like this:
dp[0]=0;dp[1]=1;dp[2]=2;dp[3]=3;dp[4]=4; //Initializing
for(lli i=5;i<=n;i++){
dp[i]=max(i,dp[i/2]+dp[i/3]+dp[i/4]);
}
it is still showing timelimit in first test case
Check this.
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.