The TransCompilator

Solved LeetCode program · 385 of 1,000

#0518 · Coin Change II

Medium Array chunk-08.md

Original English source

The coins is a list of 1, 2, and 5. The amount is 5. The ways is a list of 6 zeros. Set item 0 of ways to 1.
For each coin in coins.
For every value from coin to amount.
The previous is item (value minus coin) of ways. Increase item value of ways by previous.

Show item amount of ways.

Open in Playground Browse all 1,000 problems

Expected stdout

4