change-maker
v1.2.0
Published
An implementation of the change-making problem
Downloads
5
Maintainers
Readme
change-maker
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