GATE Computer ScienceVery hardGATE CSE
In how many ways can an amount of 30 be paid using unlimited coins of denominations 1, 3, 5 and 7, where the order of coins does not matter?
- A. 86
- B. 74
- C. 101
- D. 126
Correct answer: A. 86
The unbounded-coin DP over denominations 1, 3, 5, 7 gives 86 combinations for 30.
More Algorithms questions
- The keys 5, 3, 8, 1, 9, 2, 7, 10, 6, 4 are inserted one at a time into an initially empty max-heap (array-based, sift-up after each…
- How many different arrays of the distinct keys 1, 2, …, 10 are valid max-heaps (complete binary tree, parent larger than both children)?
- A 16-bit binary counter starts at 0 and is incremented 1000 times. The cost of an increment is the number of bits that change. What is the…
- Keys 1–7 are inserted into an empty BST in the order 4, 2, 6, 1, 3, 5, 7, giving a perfectly balanced tree. How many of the 5040 insertion…
- The KMP prefix (failure) function π[i] is the length of the longest proper prefix of P[0..i] that is also a suffix of it. For P =…
- Rabin–Karp searches for the digit pattern 26 in the text 3141592653589793, treating each 2-digit window as a decimal number reduced modulo…