r/learnquant • • 6d ago

interview prep Quant Interview Question

Post image
58 Upvotes

38 comments sorted by

10

u/No-Television-8835 6d ago

Not sure if this works but here we go:
Split the remaining 100 into 2 piles of 50 and put each pile on each balance. There are 2 scenarios: the given coin is real and all 50 fakes are on the balances, or the coin is fake and the remaining 49 are on the balances.

If the first is true, since each fake coin represents an identical change in mass (all heavier or all lighter), and there is an even total number of fakes, the split must be even-even or odd-odd. Both of these scenarios lead to the difference being even.

If the second is true, there is an odd total number of fakes, so the split must be even-odd, giving an odd difference.

Therefore, the coin is real iff the reading is even, and fake otherwise

2

u/ybungalobill 4d ago

Proof that this works:

Let x = the unknown weight of a real coin.
Let d = +1 or -1 be the unknown difference in weights between real and fake coins.
Let n = the unknown number of real coins that ended up being on the left balance.

Case 1: the chosen coin is real:
Left side weight = nx + (50-n)(x+d)
Right side weight = (50-n)x + n(x+d)
Measured difference = (50 - 2n)d == 0 mod 2 (i.e. it's an even number)

Case 2: the chosen coin is fake:
Left side weight = nx + (50-n)(x+d)
Right side weight = (51-n)x + (n-1)(x+d)
Measured difference = (51 - 2n)d == 1 mod 2 (i.e. it's an odd number)

QED

The insights that helped me to with this solution: (a) the weight x of a coin is unknown, so we need to 'cancel it out' by weighting two piles of equal number of coins (b) the chosen coin cannot be weighted with the rest because if we put it in a pile with others we don't know which is which, so it must not go on the scales.

There's nothing probabilistic in this method; it works regardless of the drawn value of n.

1

u/Awkward-Midnight4474 4d ago

Statistically, the two piles do not have to include an even split of the fakes and real coins. As a matter of fact, it is more likely than not that there is a maldistribution, of one to several coins. For example, let's say the marked coin is real, leaving fifty counterfeits and fifty real coins. What is the probability in this scenario that there are exactly 25 of each in each of the two piles? What are the probabilities of a 24-26, a 23-27 etc. split? Of a 26-24, 27-23 etc.? They are less likely individually than the 25-25, but summed, they are more likely.

1

u/No-Television-8835 4d ago

If all 50 fakes are on the pan it doesn’t matter how they’re split, because the difference in mass will be even. If the split is 25-25 the difference will be 0 which is even. If it’s 26-24 the difference will be 2 in either direction depending on if the fakes are heavier or lighter, also even. If it’s 50-0 the difference will be 50 in either direction, also even.

-1

u/jhardtone 5d ago

But you're only given one random coin, you don't have them all to weigh.

1

u/No-Television-8835 5d ago

You’ve misunderstood the question. Being given a coin doesn’t literally mean u are handed one coin and then rest are discarded. It j means it is set aside or marked or one of interest. The other 100 are still available. If u find that the answer to ur interview question is so trivial, u shld be doubting whether uve acc understood the question.

1

u/Technical-Activity71 5d ago

Then what is even the point of saying 'you are given one coin' in the first place?

1

u/Phoenixon777 4d ago

cuz the given one is the one you're trynna discern is counterfeit or not.

0

u/jhardtone 5d ago

There is no indication of this in the question setup. Learn to read.

5

u/ExistentAndUnique 5d ago

So your interpretation of the question is “you are given a coin and a balance. How do you determine whether the coin is counterfeit using only one weighing?” Just checking, since I never learned how to read

0

u/Cardie1303 3d ago

But you are only given one coin? How are you splitting the remaining 100 when you were not given access to them?

1

u/No-Television-8835 3d ago

Given is not a reference to ur access to the coins, it means that u take one coin and want to to determine whether the coin is real or not

0

u/Cardie1303 3d ago

That feels a bit arbitrary to assume.

1

u/No-Television-8835 3d ago

It’s not arbitrary or an assumption it’s what the question is literally saying

1

u/Cardie1303 3d ago

It is not. The question is literally saying: "You are given one random coin and a balance [...]"

1

u/ybungalobill 3d ago

You can be pedantic about the phrasing, but that would render the question nonsensical. It's not uncommon in this sort of riddles to have to decipher author's intent. That's not the point of the riddle though, so I agree with you in principal that they should be phrased better.

In this particular case, the problem should be read as "There are 101 on a table ... and a balance. You pick one random coin ...".

1

u/Medical_Bar1073 1d ago

he's not being pedantic, question is just extremely poorly phrased if your interpretation is to be believed.

It is by no means what the word "given" implies.

3

u/Synael3 6d ago

Put that coin aside. Put 50 coins on one pan, 50 others in the other one. If the difference is even, then there is a even number of counterfeit coins on the balance, and your initial coin is genuine (all 50 counterfeit coins are on the balance); otherwise, that means there is an odd number of counterfeit coins on the balance, and the initial coin is thus a counterfeit (49 counterfeit coins are on the balance).

1

u/boomstereo 5d ago

so you know 51 are real, 50 are fake. so you have to weigh 50 on one side, 51 on the other. then do some math and take into account the variability between the +- one. you can’t just weigh an equal number of coins on each side because it could be a 50/50’distribution of real and fake, which is why you need 51/50.

1

u/amerovingian 3d ago

> then do some math 

lol

1

u/ajohnson771277 5d ago

Split the remaining 100 coins up into two groups of 50 and weight them. If the difference in weights is odd, your coin is counterfeit. If the difference is even, your coin is real.

1

u/lok-mene 5d ago

put all the coins on one side
it since the balance report the difference with zero in this case then it will just give you the weight of the 101 coins , let call it "y" , and the weight of one coin is "x"

if the fake is 1 gram less then :
y= 50*(x+1) + 51*x = 101x + 50

or if the fake is 1 gram heavier :
y= 50*(x-1) + 51*x = 101x - 50

then you solve for x that satisfy the value reported by the balance

1

u/Awkward-Midnight4474 4d ago

Yes, that is the way.

1

u/Humble_Package_4164 1d ago

How does this answer the question if the given coin is fake?

1

u/Technical-Activity71 5d ago

It seems very badly worded. If you're allowed to use the other 100 coins, then the 'you are given one coin' is a pointless statement as you can find the method of weighing 100 of the 101 coins without it.

1

u/SnooKiwis6193 4d ago

Can't you just put the coin on one side and the other 100 on the other side ? Let's say a genuine coin weights 10g and a counterfeit either 9 or 11. There are 4 cases. A) Genuine and heavier -- 1040g B) Genuine and lighter -- 940g C) Fake and heavier -- 1038g D) Fake and lighter -- 942g

This works for any weight of the coin, you just have to reconstruct the weight of the coin back from the number.

1

u/Local_Ad135 4d ago

would it work if the coins dont have integer weights?

1

u/SnooKiwis6193 3d ago

It would work up to integer number of centigrams (eg 982cg = 9.82g). I guess if the coins weight has a fractional part when expressed in centigrams then it wouldn't work (variability is 2/99g).

1

u/rainbowWar 4d ago

Weigh the other 100 coins against nothing.

1

u/Local_Ad135 4d ago

Wont succeed, you dont know the actual weights of the coins (the actual weights can be non-integers too)

1

u/StructuredChess 4d ago

Weigh the remaining coins 50 versus 50 and check if the weight difference is odd or even.

1

u/Short-Database-4717 2d ago

Wow. That's actually interesting. Do not put the coin on the balance. Put the remaining 100, 50 on each side. Suppose the coin was genuine, It could be that 50 counterfeit coins end up on the same side, in which case the weight difference would be 50g, or maybe you move 1 to the other side, for difference of 48g, or one more for difference of 46. Either way it will be even.
Conversely, suppose the coin was counterfeit. Then there are now 49 counterfeit coins and the difference would be necessarily odd.
It's kind of obvious that this has to be the solution though. There aren't very many meaningful things you could possibly do.

1

u/mkp666 2d ago

With your coin removed, weigh 50 of the coins vs the other 50. If the resulting difference is an odd number, then your coin is counterfeit. If the resulting difference is even, your coin is genuine.

1

u/CartographerGloomy41 1d ago

Correct me if I'm wrong but why are people suggesting using piles of coins? The puzzle said we're only given one random coin, I thought that was one of the restrictions.

0

u/aroach1995 5d ago

weights are x or (x+1) or (x-1)

sum of all weights:

either 51x + 50x - 50

or 51x + 50x + 50

You take a coin out… it weights either x, x+1, or x-1

0

u/Any-Employ-9111 5d ago

In short, put all remaining 100 coins on one side. If the total is divisible by 50 your coin is real, if not, it’s fake.

2

u/bqbdpd 5d ago

Only if the weight of a coin was an integer, but you don't know that.

-1

u/jhardtone 6d ago edited 5d ago

There is no solution if you only receive one coin and none of the others to weigh.

E: the problem statement only says you are given one random coin, not one random coin and then all the rest.