Loading...
Loading...
Loading...
A machine has n coin values and each value can be used any number of times. Print every group of coins that adds up to the target amount, with the coins of a group in increasing order. Print the groups in dictionary order, one per line, coins separated by a space. If no group exists, print NONE.
Example
Input
4 7 2 3 6 7
Output
2 2 3 7
Groups 2 2 3 and 7.
Try the problem first. Open one hint at a time.
Sort the coins. Pass the same index again to allow a coin to be reused.
Stop the loop when a coin is larger than the amount left.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor