coin-change Questions

7

I understand how the greedy algorithm for the coin change problem (pay a specific amount with the minimal possible number of coins) works - it always selects the coin with the largest denomination ...
Turaco asked 26/11, 2012 at 2:42

5

Solved

Dynamic Programming Change Problem (Limited Coins). I'm trying to create a program that takes as INPUT: int coinValues[]; //e.g [coin1,coin2,coin3] int coinLimit[]; //e.g [2 coin1 available,1 coin2...
Voltaire asked 24/5, 2017 at 12:8

1

Solved

In a coin-change type of problem, I'm trying to refactor the recursive function into iterative. Given a set of coin_types, the function coinr finds the minimum number of coins to pay a given amount...
Nafis asked 7/7, 2021 at 21:58

3

Solved

I'm trying to convert a recursion problem written in Python (the 4th problem here see its repo page for details) into (Common) Lisp Here is the Python code which I've edited slightly for readabilit...
Dunton asked 25/6, 2021 at 21:12

4

Solved

Let's say I have three types of coins -- a penny (0.01), a nickel (0.05), and a dime (0.10) and I want to find the number of ways to make change of a certain amount. For example to change 27 cents:...
Krute asked 8/5, 2021 at 22:30

1

Solved

I am trying to solve a classical coin-change (dynamic) problem. To find number of all unique combinations to get a sum from infinite denominations of coins using dynamic approach, i used this metho...
Parris asked 9/8, 2020 at 19:4

3

Solved

I am learning dynamic programming and came across this famous coins change problem. The reccurence relation to solve this problem is given by countCoinsChangeRec(arr, sum - arr[i], i) + countCoi...
Kiker asked 30/12, 2019 at 18:44

1

Solved

To be specific, the problem is: Given array of denominations coins[], array of limit for each coins limits[] and number amount, return minimum number of coins needed, to get the amount, or if it's...
Hexamerous asked 23/2, 2019 at 11:33

9

Trying to program a DP solution for the general coin-change problem that also keeps track of which coins are used. So far I have it working to give me the minimum amount of coins needed but can't f...
Give asked 25/11, 2013 at 5:46

5

Solved

So; I'm a hobbyist who's trying to work through SICP (it's free!) and there is an example procedure in the first chapter that is meant to count the possible ways to make change with American coins;...
Associative asked 28/9, 2009 at 1:28

4

I want to write a function in Racket which takes an amount of money and a list of specific bill-values, and then returns a list with the amount of bills used of every type to make the given amount ...

5

Solved

I'm totally stuck and have no idea how to go about solving this. Let's say I've an array arr = [1, 4, 5, 10] and a number n = 8 I need shortest sequence from within arr which equals n. So f...
Ogren asked 1/4, 2012 at 12:13

2

Solved

I am having issues with understanding dynamic programming solutions to various problems, specifically the coin change problem: "Given a value N, if we want to make change for N cents, and we have ...
Thymus asked 7/3, 2015 at 3:12

3

Solved

input: max_weight = 550 n = 4 x_i = [120, 175, 250, 150] output: 2 // [[250, 175, 120], [150]] My initial impression is that this looks very similar to a dynamic programming coin change/knapsac...

3

Solved

Given a target amount and a list of coin denominations, my code is supposed to find the fewest coins needed to reach the target amount. Examples: C(78, [1, 5, 10, 25, 50]) = 6 we can make 78 f...

3

Solved

I am a beginner following SICP course on MIT OpenCourseWare using both the video lectures and the book available online. Yesterday I came across an example, which ask if we can write a procedure to...
Septuor asked 6/1, 2015 at 16:41

3

Solved

I'm going through some algorithms, and came across the coin change problem. When thinking about the problem I came up with this naive recursive solution: int coinChange(const vector<int>&am...

3

Solved

Hey everyone. I have a question. I am working on Visual Basic Express and I am supposed to calculate the change from a transaction. Now what code would I use? I have it partly working but its star...
Cakewalk asked 4/2, 2011 at 3:39

1

Solved

Frobenius numbers of a set exist iff the gcd of the numbers of the set is 1. Given a set of positive integers with at most 10 elements such that the gcd of all the elements is 1, how can we compute...
Landscapist asked 4/12, 2013 at 5:50

2

My apologies in advance. I'm aware that this question has been asked before with answers that have not produced the results I want/need. I am making an attempt to write a function that does the fol...
Scruggs asked 22/3, 2012 at 1:1

2

Solved

I have written a program for generating subset sum which might be used in this problem which states: Suppose, you have 3 $1-coins, 2 $2-coins, 3 $5-coins, 1 $10-coin, there are 4 ways to obtai...
Shurlocke asked 16/11, 2010 at 19:37

37

I found a piece of code that I was writing for interview prep few months ago. According to the comment I had, it was trying to solve this problem: Given some dollar value in cents (e.g. 2...
Statis asked 9/7, 2009 at 23:17
1

© 2022 - 2024 — McMap. All rights reserved.