• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
August 04, 2023 |1.1K Views
Minimum Number of Coins
Description
Discussion

In this video, we are given a value V, we want to make a change for V cents, and we have an infinite supply of each of C = { C1, C2, .., Cm} valued coins. We have to find out what is the minimum number of coins to make the change. If it’s not possible to make a change, we have to print -1.

Examples:

Input: coins[] = {25, 10, 5}, V = 30
Output: Minimum 2 coins required We can use one coin of 25 cents and one of 5 cents

Input: coins[] = {9, 6, 5, 1}, V = 11
Output: Minimum 2 coins required We can use one coin of 6 cents and 1 coin of 5 cents

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article: https://www.geeksforgeeks.org/find-minimum-number-of-coins-that-make-a-change/
Problem: https://practice.geeksforgeeks.org/problems/-minimum-number-of-coins4426/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

 

Read More