Skip to content

Commit 1bbe8c4

Browse files
Update Coin_Change.cpp (#358)
1 parent c6cdbff commit 1bbe8c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Dynamic Programming/Coin_Change.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Note: Assume that you have an infinite supply of each type of coin.
2222

2323
#include<bits/stdc++.h>
2424
using namespace std;
25+
2526
int Count_Coins(int coins[],int n,int sum){
2627
int table[sum+1];
2728
memset(table,0,sizeof(table));
@@ -32,12 +33,16 @@ int Count_Coins(int coins[],int n,int sum){
3233
table[j]+=table[j-coins[i]];
3334
}
3435
}
36+
3537
return table[sum];
3638
}
39+
3740
int main(){
41+
3842
int coins[]={1,2,3};
3943
int n=sizeof(coins)/sizeof(coins[0]);
4044
int sum=4;
4145
cout<<Count_Coins(coins,n,sum);
46+
4247
return 0;
43-
}
48+
}

0 commit comments

Comments
 (0)