GATE Computer ScienceHardGATE CS (PYQ pattern)
Using unlimited coins of denominations 2, 5, 7 and 10 (order does not matter), how many ways are there to pay exactly 40 using at most 6 coins?
- A. 34
- B. 3
- C. 4
- D. 5
Correct answer: D. 5
Grouping all 34 combinations by coin count: 4 coins: 10+10+10+10; 5 coins: 10+10+10+5+5; 6 coins: 5+7+7+7+7+7, 5+5+5+5+10+10 and 2+7+7+7+7+10. Total 1 + 1 + 3 = 5. Without the limit there are 34 ways.
More Algorithms questions
- In the array [2, 5, 3, 7, 11, 8, 10, 13, 6, 9, 4, 12] the longest strictly increasing subsequences have length 6. How many different…
- The O(n log n) LIS algorithm keeps an array t where t[k] is the smallest tail of an increasing subsequence of length k + 1; each element x…
- The longest palindromic subsequence of the string BCABDACBDCA has length:
- What is the minimum number of cuts needed to partition the string abacbbcabbacab into substrings that are all palindromes?
- How many DIFFERENT non-empty strings occur as subsequences of BANANAB (subsequences need not be contiguous; equal strings from different…
- Ten symbols with frequencies 2, 3, 4, 5, 6, 8, 10, 15, 20, 27 (total 100) are encoded with an optimal ternary (3-ary) Huffman code, whose…