Skip to content

Commit 00086ea

Browse files
committed
Add June Day 7
1 parent 2790bc4 commit 00086ea

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public:
3+
int change(int amount, vector<int>& coins) {
4+
int n = coins.size();
5+
vector<int> dp(amount + 1, 0);
6+
dp[0] = 1;
7+
for(int i = 0; i < n; i++)
8+
for(int j = coins[i]; j <= amount; j++)
9+
dp[j] += dp[j - coins[i]];
10+
return dp[amount];
11+
}
12+
};
13+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,4 @@ Since I am completing this in May, I could not access the 7th question of each w
155155
| 4 | [Reverse String](JuneChallenge/Week1/4:ReverseString.cpp) |
156156
| 5 | [Random Pick with Weight](JuneChallenge/Week1/5:RandomPickwithWeight.cpp) |
157157
| 6 | [Queue Reconstruction by Height](JuneChallenge/Week1/6:QueueReconstructionbyHeight.cpp) |
158-
| 7 | |
158+
| 7 | [Coin Change 2](JuneChallenge/Week1/7:CoinChange2.cpp) |

0 commit comments

Comments
 (0)