An open API service indexing awesome lists of open source software.

https://github.com/bapjiws/coin-change

Calculates all possible ways to combine a set of coin values to produce a given amount
https://github.com/bapjiws/coin-change

Last synced: 2 months ago
JSON representation

Calculates all possible ways to combine a set of coin values to produce a given amount

Awesome Lists containing this project

README

        

Suppose we are given a set of positive coin values sorted in ascending order.
The task is to produce all possible ways of using these coin values in order to produce the given amount.
Here's an example:



GHCi> change 7
[[2,2,3],[2,3,2],[3,2,2],[7]]

**NB:** the order in each combination matters, i.e., [2,2,3] and [2,3,2] are different.