Dsa
Recursion
Medium
Combinations of Coins
You are given an integer target which represents the total amount of money. You also have an array of distinct coin denominations. Your task is to count all the unique combinations of coins that sum up to the target amount. Write a function that reads the target amount and the list of coins from standard input and prints the number of combinations.
**Input Format:**
A target amount followed by a line containing a space-separated list of coin denominations.
**Output Format:**
A single integer representing the number of unique combinations.
**Example:**
Input:
5
1 2 5
Output:
4
Key concepts
recursioncombinationsdynamic programming
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now