fix: error if unequal

This commit is contained in:
siiky 2023-11-24 12:11:17 +00:00
parent 8e33bc527d
commit 9338aeb266

View file

@ -155,7 +155,7 @@ function makeChange(outCassettes, amount) {
const ss_solution = getSolution_old(outCassettes, amount, BILL_LIST_MODES.VALUE_ROUND_ROBIN)
const cc_solution = getSolution(outCassettes, amount)
if (!!ss_solution === !!cc_solution) {
if (!!ss_solution !== !!cc_solution) {
logger.error(new Error(`subset-sum and coin-change don't agree on solvability -- subset-sum:${!!ss_solution} coin-change:${!!cc_solution}`))
return solutionToOriginalUnits(ss_solution, outCassettes)
}