## Bloomberg LP Interview Question for Financial Software Developers

• 0

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

#1.break the coins into 3,3 and 1
#2. balance 3 and 3 (if they are equal weight then the single coin you didnt balance is the heavier coin)
else
#3. take the the side of the balance which is heavier and break it again in 1,1 and 1(discard the lighter side coins and the remaining one coin)
#4. balance again 1 and 1 each, if they are equal then the one you are holding is heavier or the one which is showing on the balance as heavier is heavier

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

@Tejaswl
The question is not about which coin is heavier, but it's which coin is different, The unusual coin may be lighter also.. Your algo is not taking this into consideration.....

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

are we given a "balancing scale" or just a "weighing scale"??? some reason financial companies are fond of "Coins" with incomplete questions. :D

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

Tejaswi has the right approach. This is one of the most repeated brain teasers

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

break it into 2,2,3
1. balance 2 and 2.
if 2=2 then goto "For 3 coins";
if 2=!2 then goto "For 4 coins";

For 3 coins:
2. balance A and B.
if A=B, then return C.
if A=!B, then do step 2.
3. balance A and C.
if A=C, return B.
if A=!C, return C.

For 4 coins:
2.Balance A and B. 3.Balance A and C.
if A=B
if A=C, then return D.
if A=!C, then return C.
if A=!B
if A=c, then return B.
if A=!c, then return A

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

break it into 2,2,3
1. balance 2 and 2.
if 2=2 then goto "For 3 coins";
if 2=!2 then goto "For 4 coins";

For 3 coins:
2. balance A and B.
if A=B, then return C.
if A=!B, then do step 3.
3. balance A and C.
if A=C, return B.
if A=!C, return C.

For 4 coins:
2.Balance A and B. 3.Balance A and C.
if A=B
----if A=C, then return D.
----if A=!C, then return C.
if A=!B
----if A=c, then return B.
----if A=!c, then return A

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

This exceeds the given constraint of 2 chances..

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

nice

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

I don't think it is possible in just 2 weighings

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

I can do it in 3 to find which is different.

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

I can do it in 3 to find which is different.

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

not possible in 2 weighings unless told lighter or heavier

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.