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
- Host: GitHub
- URL: https://github.com/bapjiws/coin-change
- Owner: bapjiws
- Created: 2015-10-25T18:51:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-25T19:02:22.000Z (over 9 years ago)
- Last Synced: 2025-01-28T16:44:24.190Z (4 months ago)
- Language: Haskell
- Homepage:
- Size: 320 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.