I am not getting how to solve it using a bottom-up approach.
I have solved it using recursion and top-down
Coins Change [Bottom Up Approach]
Hi @abhijeet.srivastava6499 -
Thanks for the DP resource.
I have solved the min coins problem using recursion, top-down, and bottom-up. But here I am trying to understand the bottom-up approach for finding total number of ways for any amount using given coins.
I understood the recurrence relation
f(n) = f(n-coins[i], coins) + f (n , coins-1)
This is the solution for finding min number of coins [https://ide.codingblocks.com/s/237146] does it has some similarity finding the total number of ways as well?
@abhijeet.srivastava6499 , @aman212yadav
It’s not working. I think here we are checking the min required coins at all indexes so it won’t help much here . So could you please suggest what should be the approach.
@S18APP-OL0003,
Here is a link to total no. of ways problem, and I solved it just by adding all the previous states of dp. I am pretty sure the recurrence is correct.