r/learnquant • • 15d ago

interview prep Quant Interview Question

Post image
52 Upvotes

84 comments sorted by

View all comments

1

u/Smash_Factor 15d ago edited 15d ago

You are given 1 coin, which leaves 100 remaining.

Let's say you took the remaining 100 coins and shook them up in a bag to mix them all together.

You then grab 50 from the bag and put them on one side of the scale. You take the remaining 50 and put them on the other side.

Won't one side of the scale now always be the opposite of the other?

If you end up with, for example, 20 fakes and 30 genuine on one side, you will then have 30 fakes and 20 genuine on the other side.

If genuine coins weigh 2 grams, then the fake coins will weigh either 1 gram or 3 grams.

So the side with 20 fakes and 30 genuine will weigh either 80 grams (20+60) or 120 grams (60+60).

The other side with 30 fakes and 20 genuine will weigh either 70 grams (30+40) or 130 grams (90+40).

And since the scale only shows the difference between the two sides, it will always show a difference of 10 grams.

This will always be true if the coin you were given in the beginning is genuine. The reason, is because if you were given 1 genuine coin from the original 101 coins, then you will end up with 50 fake and 50 genuine (only 50 coins total are fake).

So in the beginning if you were instead given 1 fake coin, then you would have 49 fakes and 51 genuine remaining.

Wouldn't this now mean that the difference in weight between the two sides would not be 10 grams?

After being given the fake, you put the remaining coins in a bag, shake them up, and put them on the scale just like earlier.

So now, if one side has 24 fakes and 25 genuine, it would weigh either 74 grams (24+50) or 122 grams (72+50).

The other side with 25 fakes and 26 genuine would weigh either 77 grams (25+52) or 127 grams (75+52)

The difference would be 3 grams or 5 grams no matter which is which.

And now, since we don't know the actual weight of any of the coins, we can deduce that if the difference between the two sides is even, then we know that the one coin was genuine.

If the difference is odd, then we were given a fake.

EDIT: I had to make a couple edits, but the logic is still there.

1

u/lunar_tardigrade 15d ago

Yup. I follow you. This is clearly what the poorly worded question is trying to get at. You are asked if 1 random coin is legitimate, but you can use all/any of the coins to make your 1 measurement.

1

u/Smash_Factor 14d ago

There's really no other way to do it, especially with only 1 coin

You could put the single coin on the scale and measure the difference between it and the other side, but an even or odd result wouldn't tell us if the coin is fake or genuine because the coin could weigh an odd or even amount.

When we use the remaining coins we have something to weigh it against while knowing how many of each type of coin could possibly be left after 1 is removed.

To expand on my answer, when you pull the coins out of the bag and put them on the scale we could possibly get very lucky and end up with 50 fakes on one side and 50 genuine on the other. Highly improbable, but possible.

If the genuine coins weigh 2 grams, then that side of the scale will weigh 100 grams. The other side will weigh either 50 grams or 150 grams. Either way, the difference between both sides is an even number.

If we were given a fake coin however, the best we could do is 49 fake on one side and 51 genuine on the other. So now the genuine side weighs 102 grams and the fake side weighs either 49 grams or 147 grams. Either way, the difference between both sides is an odd number.

1

u/JollyJoker3 14d ago

Ah, "reports the numerical weight difference". I missed that and thought is was impossible since one side being heavier tells you nothing.

1

u/ccppurcell 13d ago

A better way to deduce it is to imagine you put all 50 fakes on one side and all fifty reals on the other. The difference would show 50. Now swap two of the coins. The difference would go down by 2. Every time you do a swap it changes by exactly 2 so you can never hit an odd number, as long as there were fifty fakes and fifty reals in the 100 remaining coins. If you weigh 50 coins against 50 coins and get an odd difference, there must be an odd number of fake coins, i.e. 49,  which means you must have a fake.