Moravio - backend task - coins.
https://hackmd.io/3MSmOwe3RV6Zoyzd4JUyOQ
npm install moravio-be-coins
import { getChange } from 'moravio-be-coins';
getChange(12, [1, 2, 5]); // ✔️ [5, 5, 2]
getChange(12, [1, 4, 5]); // ✔️ [4, 4, 4]
getChange(.3, [.2, .1]); // ✔️ [.2, .1]
getChange(12, [5]); // ❌ -1
getChange()
no longer returns an object but directly the change or -1
if it can't be calculated.
npm test
Tests are run after every push on any branch.
The package is auto-published on npm after each GitHub release.
I'd be very happy to have your feedback on this.