Data Structures & AlgorithmsHardTCS NQT Digital · Product Company SDE
Problem: The number of ways to make 15 using coins of values 2, 3 and 5, where the order of coins does not matter, is what value?
- A. 77
- B. 3
- C. 2
- D. 7
Correct answer: D. 7
Solutions of 2a + 3b + 5c = 15 in non-negative integers number 7. Ordered sequences give 77, dropping the 5-coin gives 3, and requiring each coin at least once gives 2.
More Coding Interview Problems questions
- Problem: The sum of the numbers obtained by repeatedly removing the first and last elements of [1, 2, 3, 4, 5, 6, 7, 8] and adding them as…
- Problem: What is the remainder when 2^100 is divided by 9?
- Problem: The sum of all three-digit palindromic numbers (100–999) is what value?
- Problem: How many integers n with 0 ≤ n ≤ 255 have exactly four 1-bits in their binary representation?
- Problem: What is the largest power of 2 that is less than or equal to 1000?
- Problem: Find the smallest positive integer x such that floor(x/2) + x is at least 50.