# Questions tagged [change-making-problem]

The change-making problem is to find the minimum number of bills and coins that total to a given sum of money.

35 questions
Filter by
Sorted by
Tagged with
3k views

### Transform dollars in exact change

The program was to turn an integer into exact change and uses a bunch of if statements. Are there steps a beginner like me can do to remove some or is it just how it will be? I can't find anything ...
960 views

### Change-due function

I wrote a function to calculate the change due from a transaction. It also prints the number of twenties, tens, fives, ones, and coins required to meet the amount. I am looking for suggestions for a ...
260 views

### Calculating the number of coins in money change

I wrote a program that calculates the minimum number of coins required to give a user change. One concern I have is: When do we initialize the value of a float to be negative or positive? I recently ...
1k views

### Script that counts quarters, dimes, nickels, and pennies

I am learning Python and I wrote a script that counts how many coins you would need for an amount in dollars. I was wondering if I could make any improvements to it. ...
75 views

### Dividing an arbitrary dollar amount into the fewest bills and coins

I am taking a class in mobile application development this fall. I have finished my first assignment of creating a class to divide an arbitrary dollar amount into the minimum number of bills and coins....
3k views

### Optimal change with only with two euros coins and five and ten euros bills

We assume we have unlimited number of coins and bills. My code works fine but the method optimalChange() has a Cyclomatic Complexity of 8. ...
342 views

### Calculate how many coins, coin values are 50, 20, 10 and 5

The code should enter an integer between 5-95 and calculate how many coins, coin values are 50, 20, 10 and 5. My concern is the CalcChange function and whether ...
4k views

### Find the minimum number of coin change

Description: 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. If that ...
208 views

### Calculate change denominations 3

I am trying to refactor a large application to use more DDD principles as and when I get chance. I am concentrating on the very simple areas first. The app currently has a very simple Domain Service ...
1k views

### Project Euler Problem 31 (Coin Sum)

I just finished Project Euler 31: Coin sums, which asks how many ways there are to make £2 using British coins (1p, 2p, 5p, 10p, 20p, 50p, £1, and £2). When I compared my code and the problem review'...
2k views

### Creating change with the smallest number of coins

This is a basic algorithm that creates change with the smallest number of coins. How can this be better written? It works perfectly, but I just imagine there is a cleaner and shorter version of this. ...
3k views

### Change return program

I did an application that returns you quarters, dimes, nickels and pennies after you give the cost of the product and the money you gave. Can this be done any better? This seems like kind of messed up,...
2k views

### Vending machine change function

Write a function that takes an amount of money M, a price P and returns the change given in the smallest number of coins. The ...
3k views

### Return the amount of Quarters, Dimes, Nickels, and Pennies that you would get from the total amount of change [closed]

I made windows form in C# that takes the amount of change given, 1-99 and tells you the amount of quarters, dimes, nickels, and pennies you would get back. Can I improve the math in any way? It takes ...
2k views

### Counting the number of ways to break an amount into coins

I have an algorithm here that counts the number of ways that n cents can be represented using the following denominations: quarter: 25 cents dime: 10 cents nickel: 5 cents pennies: 1 cent There are ...
719 views

### Coin Change Problem with Memoization

Purpose Another take on the classic Change-making Problem: Given some set of coins and a value, find the minimum number of coins necessary to add up to this value In my implementation, instead of ...
3k views

### Make change for a given amount given denominations

Make change like at a cash register Input is the denominations of the currency and the sum In test case only coins are entered Return how many of each denomination Return the fewest possible ...
95 views

### CS50 Pset1 Greedy, change algorithm

The purpose of the code is to calculate the least amount of coins needed to produce correct amount of change given a dollar or cent user input. I'm just starting out and appreciate any pointers in how ...
408 views

### Decimal Quantities needed to meet cost

I asked this question recently: Finding the number of capital letters in a word grouped by letter. The answerer answered my specific question so I have marked it as answered. However, I would like ...
1k views

### Coin change with Dynamic Programming

I have made an implementation of coin change problem solved with Dynamic Programming. Could you guys help with renaming some method and variables? Here is my implementation - ...
431 views

### How many ways we can make the change of the amount using the coins given

Given a set of coins and amount, write an algo­rithm to find out how many ways we can make the change of the amount using the coins given. Exam­ple: Amount = 5 ...
348 views

### Coin Change Kata in ImmutableJS

I'm preparing for a job as a junior/intermediate JS developer. I'm comfortable with my ability to think in higher-order functions, but less confident in my syntax and style (I have more experience in ...
701 views

### Change-Making Problem Solution

Please take a moment and review my code and tell me how I did. This is the first time in my class (CSC 111) I've been given an assignment in which I had to use a lot of my own resources and develop ...
282 views

### A program to represent a coin amount using the smallest number of coins

Recently, I was learning about greedy algorithms. One example that was given was an algorithm for exchanging a given money amount using the smallest number of coins. After the lecture, I wrote a C ...
1k views

### Give me some change as asked in interview

Description: The goal in this problem is to find the minimum number of coins needed to change the input value (an integer) into coins with denominations 1, 5, and 10 The input consists of ...
3k views

### Coin change algorithm

I've implemented the coin change algorithm using Dynamic Programming and Greedy Algorithm w/ backtracking. The description is as follows: Given an amount of change (n) list all of the possibilities ...
1k views

### Change-making problem with specific constraints

I am a new Pythoner. I have solved a OJ project with Python. Can you tell me how can I solve it more Pythonically? Problem Description: There are n coin denominations, each with an unlimited ...
5k views

### Given a monetary amount, calculate the equivalent change

I have written a program that takes in some amount of money, and prints the equivalent change (starting at hundred dollars, to fifty, to twenty, down the pennies). Here is the code: ...
1k views

### Bills dispenser machine

I have just started out learning C++ and I am trying to write out a simple bills' dispenser machine as an exercise. Upon user input, the system is to check if it can pay out the amount but only in 20 ...
9k views

### Converting money into change

I am trying to figure out a more efficient way of converting money into change. The code below is what i have written so far. It works perfectly but i know the code can be improved. Is there a more ...
86 views

I have written a change calculator using Ada. when the user inputs an amount of money it returns a list of the coins and bills needed to create that total. It starts off by trying to use the largest ...
2k views

### Coin Change: Minimum number of coins

Problem: You are given n types of coin denominations of values $v(1) < v(2) < ... < v(n)$ (all integers). Assume $v(1) = 1$, so you can always make change for any amount of money $C$....
2k views

### Implementation of the change making algorithm

I wrote a set of python classes for solving the change making problem, in various forms. Given the coin denominations and values: Find all possible ways of making change. Find a best way ...