• Hey Guest. Check out your NeoGAF Wrapped 2025 results here!

I was asked this analytical question in interview (NO GOOGLING)

Status
Not open for further replies.
Psssh, typical nonsense response from someone who doesn't know what they're talking about. I interviewed someone once and totally asked them how many ping-pong balls could fit in a 747.

It's not about the answer, right? It's to see if the candidate can think logically through a problem.
 
Psssh, typical nonsense response from someone who doesn't know what they're talking about. I interviewed someone once and totally asked them how many ping-pong balls could fit in a 747.

Enough for an Isner-Mahut ping pong match.
 
Suppose you have 9 balls and one of the balls is lighter in weight than the others. You also have a simple weight machine. You get two tries to use the machine and your goal is to find the lighter ball.

I see the answer has already been given multiple times, as far as I know this is the only correct answer..

I was familiar with this one from a long time ago, but while we're on the subject here's an equally tricky question I was asked in a job interview which I never heard before. They gave me several minutes alone with pen and paper to think about it so I was able to come very close to a complete answer, but it's still a cool riddle.


A game is played between two players on a perfectly round board. Each player has a limitless supply of identical game pieces (think: checkers pieces), in one particular color. Lets say player 1 is white and player 2 is black.

The object of the game is to be the last player to place a piece on the board, or in other words you lose if there is no more room on the board for a piece.

Initially the board is empty, and players take turns placing one piece anywhere on the board.

Having only this information, construct a strategy to win every time. Does this strategy dictate you be given the first turn or does it not matter?
 
I typically hate questions like this. It's almost always someone trying to feel smarter than the candidate. And honestly the work isn't based on doing the work right there it's based on being able to work through it. I guess it does give insight to how the candidate thinks. But I always hate it when I'm giving an interview to a programmer and one of my cohorts turns it into a puzzle fest. Being able to solve a puzzle quickly doesn't mean you're going to do the job well. It just means you can solve puzzles quickly. Though I will admit sometimes it's nice to see how they deal with the crisis. I just personally have different tools to do that than puzzles.

Never the less, what do you mean weight machine? Like a bathroom single platform scale or a scale with two platforms? I can figure out how to do it with a scale with two platforms but I go way over on turns with a singular platform scale.

When I'm interviewing someone I'm personally more interested in the candidate's thought process than the answer. If they can walk me through the thought process and explain why they're thinking how they're thinking, that wins a lot of points even if they're wrong.

I had a coder in a few weeks ago for an interview and I asked him what the Big O complexity was for inserting or searching in a binary search tree. He would just guess and couldn't even explain why he came up with his answer. Tons of points docked there.

Even if their logic is flawed, if they can talk you through their logic it's a positive sign.
 
It's not about the answer, right? It's to see if the candidate can think logically through a problem.

Problem is like ronito pointed out you cannot judge people's crisis handling skills in such a setting. The interviewee is already under tremendous pressure under the spotlight, he will come up with the first thing that pops into his brain. There should be other methods to gauge that.
 
I'd put all the balls on the machine and record the weight as each one comes off

This would be the preferred way of doing it. However, didnt the question state you can only weight a ball twice? As in if you if you put anything on the scale then that counts as 1, and the next time you put something on there that would be your second and last time?
 
nm67WF9.png
 
When interviewers can start asking dumb questions like this, that's when you know the job market is doing desperately bad.

I don't have time to be playing games and riddles, "how many apples does Johnny have", when my bills are stacking up.
 
I got one from a test I had: you have 15 players. 10 on the pitch, 5 subs. The game is 30 minutes. The coach wants all the players to play an equal amount of time. How many minutes must each player play when there must be 10 players on at all times.
 
Use those big ass glasses of yours and read the thread.

Exactly like that.

Isn't this just a simple search algo.

Split into 3 groups. Put 2 groups onto the scale at once. If they weigh the same then its the third group or its the heaviest of the 2.

Take the heaviest group and weigh 2 balls. If one is heavier then you know that's the one. If not it's the one you didn't weigh.

You can do this for a larger set of balls as long as you increase the amount of scale usages.

Look ma. No hands.
 
You think you're so smart Mr. Fancy Pants? Well the scale I bought works more than twice so suck on that nerd.

...I actually knew the answer.
 
A game is played between two players on a perfectly round board. Each player has a limitless supply of identical game pieces (think: checkers pieces), in one particular color. Lets say player 1 is white and player 2 is black.

The object of the game is to be the last player to place a piece on the board, or in other words you lose if there is no more room on the board for a piece.

Initially the board is empty, and players take turns placing one piece on the board.

Having only this information, construct a strategy to win every time. Does this strategy dictate you be given the first turn or does it not matter?

Is there enough information to come up with an answer here?

What is the area of the board? What is the area of the game piece? Can pieces be stacked? Can pieces be moved? Do they need to be places in specific locations (do they need to be touching?) or can you place them anywhere?
 
When I'm interviewing someone I'm personally more interested in the candidate's thought process than the answer. If they can walk me through the thought process and explain why they're thinking how they're thinking, that wins a lot of points even if they're wrong.

I had a coder in a few weeks ago for an interview and I asked him what the Big O complexity was for inserting or searching in a binary search tree. He would just guess and couldn't even explain why he came up with his answer. Tons of points docked there.

Even if their logic is flawed, if they can talk you through their logic it's a positive sign.
Fuck you. Everyone keeps telling me I'm never going to use that shit.
 
Psssh, typical nonsense response from someone who doesn't know what they're talking about. I interviewed someone once and totally asked them how many ping-pong balls could fit in a 747.

Agreed. It is the thought process that counts (in the case of your question).

In any case, I am personally against questions that the entire answer completely relies on one very obscure observation. In many cases the interviewer himself wouldn't be able to answer them if he didn't know already. But some open ended question are justified if your criteria is not that candidate come up with a perfect solution on first try.

As for the question in the OP, it is too easy. I have had co-workers asking it (I am talking about Microsoft interviews for hiring SDEs) and I have criticized them for that. But my hire rates are generally lower than my co-workers.
 
You put 4 and 4 on. If they are even, the final ball is the lighter one.

If not you weigh the two and two and then you have a 50% chance of being right, I guess.

Edit - I see the answer now. This is a cool question.
 
Problem is like ronito pointed out you cannot judge people's crisis handling skills in such a setting. The interviewee is already under tremendous pressure under the spotlight, he will come up with the first thing that pops into his brain. There should be other methods to gauge that.

It's not really testing crisis management though. An interviewer can guide the candidate if required, nudge them if they are going off-course. You want the candidate to find the right questions out loud.

Clearly, a whole interview shouldn't be these kinds of questions, but one can be OK.
 
Is there enough information to come up with an answer here?

What is the area of the board? What is the area of the game piece? Can pieces be stacked? Can pieces be moved? Do they need to be places in specific locations (do they need to be touching?) or can you place them anywhere?
Don't you just need to know if there are even or odd amount of spots on the board. The size doesn't matter.
 
I got one from a test I had: you have 15 players. 10 on the pitch, 5 subs. The game is 30 minutes. The coach wants all the players to play an equal amount of time. How many minutes must each player play when there must be 10 players on at all times.

10/15 players * 30 minutes = 20 minutes / player?

Don't you just need to know if there are even or odd amount of spots on the board. The size doesn't matter.

But if the spots aren't predetermined (if pieces don't need to be placed optimally on the board) then it changes the answer considerably.
 
Suppose you have 9 balls and one of the balls is lighter in weight than the others. You also have a simple weight machine. You get two tries to use the machine and your goal is to find the lighter ball.

first weigh

put three balls on one side and three balls on the other. if one side is lighter than the other put two of the three balls from the lighter side on the weight machine. if the set of three balls are the same weight put two of the three balls you didn't weigh on the machine.

second weigh if the balls you weigh are the same the one you didn't weigh is the lighter ball. otherwise the lighter ball is the lighter ball.
 
Man, questions like these make me afraid of interviews. :(

Ok, so you're at the middle of a circular pond, and there are two fuses that will burn a velociraptor for 45 minutes. If you leave the sheep and wolf together, the sheep will eat the wolf. How many eggs do you need to break to escape the pond?
 
I would ask them if they're serious about getting work done or if they spend all day looking up stupid puzzles on the Internet so they can pretend to be cool like a late 90's startup.
 
Is everyone just assuming that the other balls that are not the light ball, all weigh the same as each other?

You would think so. I don't know how you could find the lightest ball with only two uses of the scale if they're all different weights.
 
10/15 players * 30 minutes = 20 minutes / player?



But if the spots aren't predetermined (if pieces don't need to be placed optimally on the board) then it changes the answer considerably.
Maybe I am misunderstanding the question. You just place pieces. There is no blocking or anything. You can't skip a turn I assume. So isn't it just like being the last person to pick a quarter out of a pile of quarters. You only need even or odd and then you decide if you are first or not. Let me read the post again.

Edit: I see what you are saying.
 
Is there enough information to come up with an answer here?

What is the area of the board? What is the area of the game piece? Can pieces be stacked? Can pieces be moved? Do they need to be places in specific locations (do they need to be touching?) or can you place them anywhere?

sorry, should have stated: players take turns placing the piece anywhere on the board.

I've fixed my post.


Also, if you'd like a hint, my thought process started out like yours.

The first step was thinking to myself "wow there really isn't a lot of information here".

this was a critical step for me.
 
Ok, so you're at the middle of a circular pond, and there are two fuses that will burn a velociraptor for 45 minutes. If you leave the sheep and wolf together, the sheep will eat the wolf. How many eggs do you need to break to escape the pond?

The doctor is the patient's mother.
 
Yeah. Shit took me way too damn long.

Whenever I have a math problem like that and I need a nudge, I make sure to label my values. If you know that you're trying to find minutes per player, then that means you need to divide minutes by players at some point. That should at least give you a way to verify your answer if you're unsure.
 
4 - 4 one on the side
if the 4 - 4 are equal the one on the side if the lighter one.

if the 4 - 4 are not equal take the 4 of the lighter side.
split them 2 - 2 pick the 2 from the lighter side.

And feel with your hands which is the lighter one and pray that the weight difference is big enough to feel.
 
Problem is like ronito pointed out you cannot judge people's crisis handling skills in such a setting. The interviewee is already under tremendous pressure under the spotlight, he will come up with the first thing that pops into his brain. There should be other methods to gauge that.

Huh? Maybe I'm not understanding your post, but it sounds like you're saying the problem is that you can't judge someone's ability to think under pressure when they're in an interview because that would be asking them to think under pressure.

I had this exact question come up during the interview I had for my current job, except it was 3 tries and it phased me for all of 2 seconds. You collect yourself, clarify what they're asking and work it through. They just want to see your logic process and if your only reaction is "OH FUCK OH FUCK OH FUCK" you're probably not what they're looking.

4 - 4 one on the side
if the 4 - 4 are equal the one on the side if the lighter one.

if the 4 - 4 are not equal take the 4 of the lighter side.
split them 2 - 2 pick the 2 from the lighter side.

And feel with your hands which is the lighter one and pray that the weight difference is big enough to feel.

The 3 - 3 - 3 method works if you only have 2 tries. 4 - 4 - 4 works if you have 3.
 
Ok, so you're at the middle of a circular pond, and there are two fuses that will burn a velociraptor for 45 minutes. If you leave the sheep and wolf together, the sheep will eat the wolf. How many eggs do you need to break to escape the pond?

Enough eggs to make the chicken cry. Chicken crying sends sheep running. Wolf chases sheep. Wolf gone = area around pond is now safe. I now have 45 minutes to take my time escaping the pond while the velociraptor burns to death.

The answer is wrong, but how many points do I get for the thought process?
 
Ok, so you're at the middle of a circular pond, and there are two fuses that will burn a velociraptor for 45 minutes. If you leave the sheep and wolf together, the sheep will eat the wolf. How many eggs do you need to break to escape the pond?

I read that last line as "How many legs do you need to break to escape the pond" and my answer was "A duck."
 
I see the answer has already been given multiple times, as far as I know this is the only correct answer..

I was familiar with this one from a long time ago, but while we're on the subject here's an equally tricky question I was asked in a job interview which I never heard before. They gave me several minutes alone with pen and paper to think about it so I was able to come very close to a complete answer, but it's still a cool riddle.


A game is played between two players on a perfectly round board. Each player has a limitless supply of identical game pieces (think: checkers pieces), in one particular color. Lets say player 1 is white and player 2 is black.

The object of the game is to be the last player to place a piece on the board, or in other words you lose if there is no more room on the board for a piece.

Initially the board is empty, and players take turns placing one piece anywhere on the board.

Having only this information, construct a strategy to win every time. Does this strategy dictate you be given the first turn or does it not matter?

My guess is that as long as the board can fit 2 or more pieces you would want your opponent to place his game piece first. That way you can always ensure that there is always room for one more game piece on the board regardless of where your opponent places his/hers game piece next. Basically, construct a scenario where your piece is the last to be placed and work your way backwards.
 
Ok, so you're at the middle of a circular pond, and there are two fuses that will burn a velociraptor for 45 minutes. If you leave the sheep and wolf together, the sheep will eat the wolf. How many eggs do you need to break to escape the pond?

42
 
This isn't too hard - it's identifying that you essentially have a 'third' scale by knowing that anything you don't weigh is still information.


One of the harder versions of this was explained to me in a similar manner, whereby there are actually TWELVE balls (or pennies as it was told to me), and you don't even know if the odd one is lighter OR heavier, but you get three weighs.

This one is particularly tough, but I'm pretty sure it can be done.
 
Status
Not open for further replies.
Top Bottom