Type an input and write what you think is the output . Each problem is converted to Web Assembly, so any possible input will show the corresponding output. Only correct predictions count.
Locked until you have predicted 3 outputs correctly.
| 1 | int solution(int amount, const vector<int>& coins) { |
| 2 | |
| 3 | vector<int> ways(amount + 1, 0); |
| 4 | ways[0] = 1; |
| 5 | |
| 6 | for (int coin : coins) { |
| 7 | for (int value = coin; value <= amount; value++) { |
| 8 | ways[value] += ways[value - coin]; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | return ways[amount]; |
| 13 | } |
Names have been stripped. The signature is the only clue you get for free. Compiled as C++20 with the standard headers and using namespace std; already in scope.