coin-master
v1.0.4
Published
Change return algorithm for a vending machines
Downloads
3
Readme
What is this?
This is a change return algorithm for a vending machine. It is universal in terms of coin values and it has infinite amount of coins of all types. However for the user it is crucial that the machine returns smallest amount of coin possible.
Installation
npm i coin-master --save
import { coin } from 'coin-master';
coin({
coins: [1, 2, 5],
total: 12
})
Parameters
We have 2 required parameters:
- coins - [1, 2, 5] (array of available coins, element 1 is required)
- total - integer (amount of rest)