Update appNew update is available. Click here to update.
sidenav-btnClose
Topic list
Find Minimum Number Of Coins
EASY
15 mins
28 upvotes
Other topics
Problem solved
Badge
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
Linked List
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
userLevel
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Find Minimum Number Of Coins

Contributed by
Sakshi Bansal
Easy
yellow-spark
0/40
Avg time to solve 15 mins
Success Rate 85 %
Share
28 upvotes

Problem Statement

Dora, the explorer, visits India and decides to try the famous Indian food. However, the restaurant accepts only Indian currency i.e. [1, 2, 5, 10, 20, 50, 100, 500, 1000] valued coins.

So, Dora goes to a bank that has an infinite supply of each of the denominations to make a change for a given ‘Amount’ of money. As a cashier at the bank, your task is to provide Dora the minimum number of coins that add up to the given ‘Amount’.

For Example
For Amount = 70, the minimum number of coins required is 2 i.e an Rs. 50 coin and a Rs. 20 coin.
Note
It is always possible to find the minimum number of coins for the given amount. So, the answer will always exist.
Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1
2
13
20
Sample Output 1
3
1
Explanation of Sample Input 1
For the First Test Case ,the minimum number of coins to make the change are 3 {1, 2, 10}.

For the second Test Case, only one coin {20} is required.
Sample Input 2
2
50
96
Sample Output 2
1
5
Reset Code
Full screen
Auto
copy-code
Console