Skip to content

Instantly share code, notes, and snippets.

View PratyushRaizada94's full-sized avatar

Pratyush Raizada PratyushRaizada94

  • Bangalore
View GitHub Profile
#!/usr/bin/env node
// Solve the "Coin Change" problem using a bottom-up dynamic programming
// approach. The time complexity is O(n * coins.length) since we have a nested
// loop. The storage complexity is the same, as we store a matrix.
//
// * `coins` is an array of the coin values, eg. [ 1, 2, 3 ]. We assume it
// to be non-empty.
// * `n` is the amount, eg. 4 cents.
//