Question bank › Greedy
Dsa Greedy Warm-up

Coins for Change

You are given a set of denominations of coins and a total amount of money. Your task is to determine the minimum number of coins required to make up that total amount. You can use any number of coins of each denomination for your calculation. Input Format: - The first line contains an integer n, the number of coin denominations. - The second line contains n space-separated integers representing the coin denominations. - The third line contains an integer amount, the total amount of money. Output Format: - An integer representing the minimum number of coins needed to make the total amount, or -1 if it's not possible. Example: Input: 3 1 2 5 11 Output: 3

Key concepts

greedyarraycounting

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.