Count the coins/0-1: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
(Make last example easier)
Line 15: Line 15:
*   coins = [1, 1, 2, 3, 3, 4, 5] and sum = 6
*   coins = [1, 1, 2, 3, 3, 4, 5] and sum = 6


*   coins = [1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 15, 15, 10, 10, 10, 10, 10, 25, 25, 100] and sum = 40
*   coins = [1, 2, 3, 4, 5, 5, 5, 5, 15, 15, 10, 10, 10, 10, 25, 100] and sum = 40


;Extra
;Extra

Revision as of 07:10, 6 January 2021

Count the coins/0-1 is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Let say you have some coins in your wallet and you want to have a given sum.

You can use each coin zero or one time.

How many ways can you do it ?

Task

Show the result the for the following examples:

  •   coins = [1, 2, 3, 4, 5] and sum = 6
  •   coins = [1, 1, 2, 3, 3, 4, 5] and sum = 6
  •   coins = [1, 2, 3, 4, 5, 5, 5, 5, 15, 15, 10, 10, 10, 10, 25, 100] and sum = 40
Extra

Show an example of coins you used to reach the given sum.