4 ms·
so funny to read the reactions here. "Puzzles are stupid and hiring is broken" without thinking about how to navigate a question like that. I think someone wit
by xyzelement 3mo ago
so funny to read the reactions here. "Puzzles are stupid and hiring is broken" without thinking about how to navigate a question like that.
I think someone without an "aha moment" can use a question like this to nail an interview:
Candidate: thank for your the questions. I don't immediately see how we can solve this by using the scale only 3 times. What I would normally do in situations like this is explore a simpler problem to get an understanding of the space and some solution that works and then try to improve it. Can I try that?
Interviwer: absolutely.
Makes a note: candidate able to propose an approach when answer not obvious. Able to nareare their thinking.
Candidate: let me think about a naive solution first. We just weigh the balls in pairs. If two balls weigh the same then neither is the answer. If the pair doesn't weigh the same then one is the answer but we don't know which one. So we need to compare one of them against any of the other balls: if the scale is unbalanced then that one is the answer, otherwise the other one. I think this tells us which ball is the answer but obviously we use the scale too many times. In this case at best we use the scale twice and at worse seven times.
Interviwer: great - I agree this works but uses the scale too much. How can we improve it?
Makes a note: candidate able to design a simple algorithm that gets the answer.and evaluate its performance.
Candidate: the fact that we have to do the final weighting even after we know which pair has the imbalance and the fact that I can compare against any other ball seems interesting. Let me think about that for a second.
...
Hmm hmm hmm
...
Hmm hmm hmm
(Fails to have the aha moment)
Interviwer: ok that's a good insight. What if you could place more than one ball on each side of the scale at a time? (Gentle hint that can put the candidate on track without giving away the answer)
Candidate: oh interesting! I wasn't visualizing it that way.
...
Ok! So we have the pattern of "figure out which pair has the imbalance and then which one in the pair is the weird one" so now we can generalize it
Let's try this: I weigh 3 vs 3. If balanced, it takes me 2 weighings to figure out which set of 3 contains the answer. And from there another 1 or 2 to figure out which of those 3 balls is the answer. So now our "worst case" has gone from 7 to 4. That's better but still falls short of our goal of course ...
Interviwer:
Makes a note: candidate is open-minded to feedback and made good use of a subtle hint to improve their solution while still realizing the goal is not met.
OK! this is a good improvemen. There was something interesting you said: that it could take 1 or 2 weighings to figure out which ball of the 3 is the answer. I am curious about the case when you can do it with 1. What's that about?
Candidate: well if we weigh two balls and they are the same - that tells us something about the one we didn't weigh. OH! Ok I see why you are drawing my attention to that.
What if we took the same approach to the initial step of the problem. Let's try: split the 12 into 3 sets of 4...
(Etc etc)
Interviwer: this was fun! Thanks for working through this problem with me
Makes a note: candidate is a solid problem silver, able to define and analyze a solution and look for improvements. Did not give up. Listened carefully and made good use of hints provided. Able to show transpancy into their thinking and collaborative. Would not hesitate to bring them on the team, leaning hire.
Better than "this is a bad question, I hate puzzles" huh.