Questions tagged [coin-change]

All problems (regardless of currency) with making change from a given amount of currency into a number of coins and bills of varying denominations.

All problems with making change from a given amount of currency into a number of coins and bills of varying denominations.

For example, finding the correct number of $20, $10, $5, $1 bills and $0.25, $0.10, $0.05, and $0.01 coins that add up to a given sum.

Variations of the problem are to find any solution, all the solutions, the one with the least number of coins / bills, or with a specific number of them.

260 questions
0
votes
1 answer

Lowest Number Of Coins

Please find the question context as follows: Write a program that takes in a floating point value representing an amount, for example 2.8 indicating 2 dollars and 80 cents. The program should then display the minimum number of coins required to…
jaydxn1
  • 47
  • 2
0
votes
3 answers

Given N, for consecutive numbers from 1 to N create a recursive C# method to print out all possible '+' and '-' combinations that result in X

I'm dealing with the following assignment, and as I'm not very familiar with recursion I'm at a loss. I'd greatly appreciate it if someone with more experience could point me in the right direction. The assignment reads as follows: Write a console…
0
votes
2 answers

Coin Change : Find number of ways to reproduce a given sum

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1, S2, .. , Sm} valued coins, how many ways can we make the change? The order of coins doesn’t matter. For example, for N = 4 and S = {1,2,3},…
0
votes
1 answer

Count Change Example in Structure and Interpretation of Computer Programs section on Tree Recursion

In section 1.2.2 of the classic text Structure and Interpretation of Computer Programs, there is an example of how to count the number of ways to break an amount of money into smaller denominations. Here is the language they wrote: It takes only a…
0
votes
0 answers

Finding minimum no. of denominations that can be used to give change for x

Variation 1: What if in coin change problem, you had to find out the minimum number of denominations that can be used to give change for an input X. I understand the Greedy & DP approach for this. Try out all possible combinations of size r ( r=1…
0
votes
1 answer

Min Coin Change - Dynamic Programming

Question - You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount.Infinite supply of coin is there. My Approach - I have followed…
0
votes
1 answer

Interfacing to bill/coin acceptors and printers

I have been approached regarding building a touch screen app for a client, but as it will be for use on kiosk machine it needs to interface with a bill/coin acceptor and a printer. What are the common the ways of accomplishing this?
davivid
  • 5,910
  • 11
  • 42
  • 71
0
votes
1 answer

Coin Chane - Dynamic Programming - How read all solutions from the DP table

I have seen different solutions to the same problem, but none of them seem to use the approach I used. So here I'm trying to solve the classical coin-change problem in a bottom up dynamic programming approach using a DP table. int[][] dp = new…
Display name
  • 637
  • 1
  • 7
  • 16
0
votes
1 answer

Maximum number of quizzes that can be formed with given conditions

There are a total of n questions available. The objective is to find and generate as many quizzes as possible with the following conditions. INPUT : Each question belongs to any one of the 3 categories. namely JAVA ,PYTHON and MYSQL Each question…
Arun Gowda
  • 2,721
  • 5
  • 29
  • 50
0
votes
2 answers

How to know if I created a greedy algorithm or not?

I've read that a greedy algorithm only take cares for the optimal solution that is trying to reach at that moment, but is this the only criteria I should consider if I want to create a greedy algorithm? Aslo, how can I know if I have created a…
Anthony Luzquiños
  • 739
  • 11
  • 23
0
votes
1 answer

Algorithm to fit into goal sum using provided units of measure with least overage

Here is an example: Customer orders 57 single peaces of an item. The company only sells in units of 15 and 6. The algorithm has to figure out the best possible combination of UOMs (unit of measure) with the following priorities in order of…
boruchsiper
  • 2,016
  • 9
  • 29
  • 53
0
votes
2 answers

recursive solution for coin change problem

i need to write an algorithm that receives a number and a list of numbers and returns the number of possible combinations of numbers from the list that can create the sum number. for example: def coin(5,[1,2,5,6] should return the number 4 because…
ofek reches
  • 1
  • 1
  • 1
0
votes
1 answer

Using modulus to solve coin change question

I'm looking for a different way to solve coin change problem using modulus. Most solutions refer to use of dynamic memory to solve this. Example: You are given coins of different denominations and a total amount of money amount. Write a function…
0
votes
2 answers

Java Coin Change Problem Using Recursion -- not working

I searched up the code and logic for this and basically copied the code from https://www.youtube.com/watch?v=k4y5Pr0YVhg and https://www.techiedelight.com/coin-change-problem-find-total-number-ways-get-denomination-coins/ But my program is wrong…
0
votes
0 answers

Coin Change algorithm for a limited coin?

My program is tasked to count all possible combinations of getting the value of T, with a list of coins with varying (and some identical) values with limited amount of coins. Two coins with different names could have a same value, for example both…
Lil Student
  • 17
  • 1
  • 4