## Interview Question

Country: United States

Comment hidden because of low score. Click to expand.
0
of 0 vote

We have 2 choices for choosing a coin or not choosing it: 2^8

The situation that (3paisa is chosen and 1paisa and 2 paisa is not chosen) or (3paisa is not chosen and 1 paisa and 2 paisa is chosen) is counted twice: each situation: 2^5 ( since 1paisa, 2paisa, and 3 paisa does not have the choice. they are already set!)

2^8 - 2^5 is the answer!

Comment hidden because of low score. Click to expand.
0
of 0 vote

Look at first 5 coins (5ruppes,1rupees,50paisa,25paisa,10paisa): none of them can be formed by sum of any subset of others 7 coins. Easy to check that since coin[i] > coin[i+1] + coin[i+2], for i = 1..5
Thus, using first 5 coins we can form 2^5 -1 none zero sums.

For last 3 coins (3paisa,2paisa and 1paisa): we can form only 6 different none zero sums, that is, 1, 2, 3, 4, 5, and 6.

So, the total number of sums can be formed is 6 * (2^5-1) + 6 + (2^5-1) + 1 (for zero-sum).

Please tell me if I am wrong! Thanks!

Comment hidden because of low score. Click to expand.
0

Maybe should count by this way:
First 5 coins: 2^5 sums, including 0-sum;
Last 3 coins: only 7 sums (instead of 8), including 0-sum;
Total: 7 * 2^5

Comment hidden because of low score. Click to expand.

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.