A few bug fixes.

This commit is contained in:
krahets
2023-11-03 22:48:43 +08:00
parent 6c16276494
commit 5f3ad1ed3d
26 changed files with 52 additions and 52 deletions

View File

@@ -18,7 +18,7 @@ func coinChangeDP(coins: [Int], amt: Int) -> Int {
for i in stride(from: 1, through: n, by: 1) {
for a in stride(from: 1, through: amt, by: 1) {
if coins[i - 1] > a {
// i
// i
dp[i][a] = dp[i - 1][a]
} else {
// i
@@ -40,7 +40,7 @@ func coinChangeDPComp(coins: [Int], amt: Int) -> Int {
for i in stride(from: 1, through: n, by: 1) {
for a in stride(from: 1, through: amt, by: 1) {
if coins[i - 1] > a {
// i
// i
dp[a] = dp[a]
} else {
// i

View File

@@ -17,7 +17,7 @@ func coinChangeIIDP(coins: [Int], amt: Int) -> Int {
for i in stride(from: 1, through: n, by: 1) {
for a in stride(from: 1, through: amt, by: 1) {
if coins[i - 1] > a {
// i
// i
dp[i][a] = dp[i - 1][a]
} else {
// i
@@ -38,7 +38,7 @@ func coinChangeIIDPComp(coins: [Int], amt: Int) -> Int {
for i in stride(from: 1, through: n, by: 1) {
for a in stride(from: 1, through: amt, by: 1) {
if coins[i - 1] > a {
// i
// i
dp[a] = dp[a]
} else {
// i