Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aa4b61f

Browse files
authored
Create Solution.java
1 parent ecc2f8f commit aa4b61f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int change(int amount, int[] coins) {
3+
int[] f = new int[amount + 1];
4+
f[0] = 1;
5+
for (int coin : coins) {
6+
for (int i = coin; i <= amount; ++i) {
7+
f[i] += f[i - coin];
8+
}
9+
}
10+
return f[amount];
11+
}
12+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /