We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8080f27 commit b66e318Copy full SHA for b66e318
MinimumCoinChange/Sources/MinimumCoinChange.swift
@@ -64,7 +64,10 @@ public struct MinimumCoinChange {
64
if value - coin >= 0 {
65
var potentialChange: [Int] = [coin]
66
potentialChange.append(contentsOf: _changeDynamic(value - coin))
67
- potentialChangeArray.append(potentialChange)
+
68
+ if potentialChange.reduce(0, +) == value {
69
+ potentialChangeArray.append(potentialChange)
70
+ }
71
}
72
73
0 commit comments