0% completed
Any idea why '+1' is added to count1 i.e. while including the coin at the curren...
Lucifer
Mar 3, 2022
Any idea why '+1' is added to count1 i.e. while including the coin at the current index?
1
0
Comments
Avinash Agarwal4 years ago
That is because we are saying there is way to reach this total while including this coin.
Ray 3 years ago
The count1 = res + 1 is really hard to visualize.
I'm not sure I really understand it (as it goes through the recursive layers).
In the nested, recursive calls, it either returns 0 (total was found) or MAX_VALUE (total not found) from the coin(s).
How does count1...
George 3 years ago
I still don't understand why we add 1 when we're including current coin.
How are we certain that whenever coins[i]
George 3 years ago
ok nvm i think i partially get it.
We add 1 because we are including the current coin to the minimum count at the remaining amount (ie. dp[index][t-denominations[index]].
On this page