mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
Fixed the syntactical bug
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
function change(coins, amount) {
|
function change (coins, amount) {
|
||||||
const combinations = new Array(amount + 1).fill(0)
|
const combinations = new Array(amount + 1).fill(0)
|
||||||
combinations[0] = 1
|
combinations[0] = 1
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ const coinChangeComb = (amount, coins, idx, mem) => {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
function minimumCoins(coins, amount) {
|
function minimumCoins (coins, amount) {
|
||||||
// minimumCoins[i] will store the minimum coins needed for amount i
|
// minimumCoins[i] will store the minimum coins needed for amount i
|
||||||
const minimumCoins = new Array(amount + 1).fill(0)
|
const minimumCoins = new Array(amount + 1).fill(0)
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ function minimumCoins(coins, amount) {
|
|||||||
return minimumCoins[amount]
|
return minimumCoins[amount]
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main () {
|
||||||
const amount = 12
|
const amount = 12
|
||||||
const coins = [2, 4, 5]
|
const coins = [2, 4, 5]
|
||||||
console.log(
|
console.log(
|
||||||
|
Reference in New Issue
Block a user