Removing redundant if condition

for loop above if condition is starting from coin and operation is increment in loop
so value of i will be always >= coin 
hence if condition is redundant there
This commit is contained in:
Ravi Desai
2018-07-05 10:57:20 +05:30
committed by GitHub
parent 595cc8fd6b
commit ddb7614535

View File

@ -29,9 +29,7 @@ public class CoinChange {
for (int coin : coins) {
for (int i=coin; i<amount+1; i++) {
if (i>=coin) {
combinations[i] += combinations[i-coin];
}
}
// Uncomment the below line to see the state of combinations for each coin
// printAmount(combinations);