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.
coin-change
266
questions
2
votes
0
answers
48
views
Coin Change Recursive, memoization gone wrong
I'm trying to understand why first one fails and second works, all I'm doing is passing along coinTrack, call it redundant but why does it not work?
It works without memoization, but on using ...
-2
votes
1
answer
115
views
Coin Change: for loop analysis
I am trying to comprehend the problem which has different wording but I figured it is similar to coin change problem
Question:
Two friends are playing a game with a book numbered from 1 to 9. The game ...
-1
votes
3
answers
201
views
Similar to a coin change problem, but with "coin" repetitions and another optimization goal
The goal is to get a list of all possible variants of sequences of positive integer (nominal coin) values from a list L where each integer (nominal coin) value can be used multiple times (i.e. ...
1
vote
1
answer
56
views
Coin Change run timeout
I was trying to solve the Coin Change problem. I used two similar pieces of code, but the result is that one passed, while the other run timeout.I want to know why these two similar pieces of code has ...
1
vote
2
answers
100
views
Debugging a leetcode solution in javascript - coin change,
I solved a leetcode question that looks correct to me, but It's not and I am unable to understand why it is wrong. Can someone please tell me why my solution is not working
Following is the question
...
0
votes
0
answers
85
views
Coin Change Problem - apply Dynamic Programing on my recursive code
I am working on the HackerRank Coin Change problem - where you are required to calculate the total number of unique ways to give change for n amount from an infinite number of coins from list c.
I am ...
1
vote
4
answers
192
views
Give change using optimal denominations *considering that using descending units might not result in a correct result
I'm struggling to solve a problem regarding a programming challenge:
Rules:
The cash register only has $2, $5, and $10 bills. Your algorithm should determine the best way to give change for any ...
1
vote
0
answers
110
views
Why does my solution not work for coin change problem?
At every recursive call I choose 1 more of current denomination or no more of current denomination. I sort the denominations in descending order and use a cache of seen remaining amount. Since I try ...
1
vote
2
answers
109
views
How to avoid duplicating the ArrayList on every recursive call
I have been trying to solve this leetcode question Combination Sum
Given an array of distinct integers candidates and a target integer, >return a list of all unique combinations of candidates ...
0
votes
1
answer
54
views
Find the combination of coin chips by minimising the value of E=4N + 0.3n
I want to find the perfect combination of coin chips for an amount (say A) for given denominations = [0.1, 0.5, 1, 5, 20, 100, 500].
There are multiple combinations possible but we have to consider ...
1
vote
1
answer
59
views
Calculating currency combinations efficiently
In the game Team Fortress 2, weapon, metal, and keys are used as currencies. Metal is subdivided into three types: scrap, reclaimed, and refined (from now on "scrap", "rec" and &...
0
votes
0
answers
323
views
Coin Change Problem return coins used along with minimum coin value
import java.util.*;
public class CoinChange {
public static int coinChange(int[] coins, int amount) {
// Create an array to store the minimum number of coins needed to make change for ...
1
vote
0
answers
110
views
Coin change problem with constraint: at most two coins in each denomination
I am studying recursive formulas in the famous coins problem in dynamic programming. However, I cannot solve this variation where there is a constraint where each coin (a power of two) could be used ...
0
votes
1
answer
235
views
Coin Change Dynamic Programming Problem (limited supply of coins)
I'm trying to solve the coin change problem with the variation that the same coin can be used at most twice.
I solved the problem where the coins are unlimited but I still don't quite understand how ...
3
votes
4
answers
375
views
How can I use dynamic programming in Scheme to solve the Coin Change problem?
I'm trying to learn a Lisp language and have settled on Guile and am trying to solve this problem:
You are given an integer array coins representing coins of different denominations and an integer ...