change-maker

1.2.0 • Public • Published

change-maker

Circle CI

Coverage Status Dependency status Dependency status npm version Known Vulnerabilities

Change Maker is a simple general purpose implementation of the 'change making' problem, this module has been created to talk candidates through a greedy (but memoised and sideffectless) implementation of this classic knapsack problem.

Usage

npm install change-maker
const makeChange = require('change-maker');
 
// Where the first argument is a string representing the amount and the second is the array of coin denominations
const change = makeChange('$2.34', [100, 50, 25, 10, 5, 1]); // { '100': 2, '50': 0, '25': 1, '10': 0, '5': 1, '1': 4 }

Testing

npm test
npm coverage // runs tests and generates coverage report

Contrubuting

All contributors will abide by the CODE_OF_CONDUCT.md.

License

MIT

Package Sidebar

Install

npm i change-maker

Weekly Downloads

0

Version

1.2.0

License

MIT

Last publish

Collaborators

  • joe8bit