Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

So...my recruiter just called me to confirm my interview on Thurs. He also mentioned that I am going to be asked to answer for two analytic questions. He gave me a little bit about those questions.

  1. There are eight balls. One of them is defective.
  2. There are three incandescent light bulbs inside a room, but switches are placed outside.

These are all he said. I think that these are not completed question.

Anyone knows what questions these are??

Does my question belong to programmer.stackexchange.com? I thought it would because it is related to interview questions.

share|improve this question

closed as unclear what you're asking by gnat, MichaelT, Michael Kohne, BЈовић, Jimmy Hoffa Aug 5 '13 at 14:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Are you sure you understood correctly? "Three" is probably "There" and I have no idea what birds is in relation to. Maybe Pokemon? –  aqua Feb 23 '11 at 0:16
@aqua // corrected –  Moon Feb 23 '11 at 0:19
All you need to know: codeslate.com/2007/01/you-dont-bury-survivors.html –  Crazy Eddie Feb 23 '11 at 0:20
Well they are definitely incomplete questions, I assume, if that was all he said, that these are supposed to be the start of known, common questions. I would google them, see what you find. –  Orbling Feb 23 '11 at 0:43
Answers: 1) it's time to see a urologist. 2) you can reduce your electricity bill approximately 63% by switching to LED, contact your local utilities provider for more details –  Andrew Heath Feb 23 '11 at 4:56

6 Answers 6

up vote 5 down vote accepted

I'm used to seeing these described a bit more:

Some companies used to ask these kinds of problems as a way to determine how logical and analytical someone could be on their feet. That was also back before the Web to some degree as now most of these are well-known enough that some people like collecting the answers.

@asoundmove, that is some basic Googling but does anyone see what assumptions I made in looking up the problem? How well does one know how to verify that the given problems will match what I've linked and not be something else entirely? For example, perhaps the defective one of the eight balls is just a different color and size and how would one find that out is the question. There are lots of creative tweaks one could make to these problems and then someone may be back at square one or possibly come off worse for assuming an answer that may or may not be correct. Thus, one should be careful about blindly accepting what someone reads on-line.

share|improve this answer
I think this is exactly what I was looking for. –  Moon Feb 23 '11 at 0:18
Great finds, but then that defeats the purpose of the interviewer. @Moon: If you have a pre-minced answer, be ready for more questions as I'm sure the interviewer will know the difference between you looking up the answer and you showing your ability to think on your feet. –  asoundmove Feb 23 '11 at 0:23
@asoundmove: you're right they defeat the purpose, and that's why questions like these for interviews are silly. –  whatsisname Feb 23 '11 at 1:54

Communication is a vital component of being employable. I would actually suggest that you learn to proofread before Thursday. Here are some hints to get you started:

  1. Three -> "There"
  2. switchers -> "switches"
  3. completed question -> "complete questions"
  4. answer for two -> "answer two"
share|improve this answer
Good point but to be fair this may not be an English speaking country. –  Kirk Broadhurst Feb 23 '11 at 1:02
Thank you for your corrections. –  Moon Feb 23 '11 at 2:31
// I know this website is not a English grammar website, but what's wrong with switchers, completed question, and answer for two??? –  Moon Feb 23 '11 at 2:32
@moon: A "switcher" is someone who switches (possibly by operating switches_, a "switch" is something that has multiple discrete states, with each state changing something. "Completed question" is the wrong numerus for "these" and for the fact that you have posted two questions, not one question. –  Vatine Feb 23 '11 at 10:43
@Vatine: Thanks for explaining! –  Jonathan Khoo Feb 23 '11 at 21:31

For f*cks sake, tell them there is absolutely no correlation between solving logic puzzles and being a good developer. It's a scam perpetrated by people who do not have any idea how to interview. What makes a good dev? Being able to work as a team contributor is much more important than throwing out quips about man-hole covers. Ask them how well they satisfy Joel Spolsky's 12 steps to better code, do they prefer SlashDot over Stack Overflow? Show them that you do more than just code on the job, you also do some after hours improvement (you do don't you)?

share|improve this answer
A company wants a creative problem solver who might be able to conceive new ways to attack their old problems. These type of problems encourage creative problem solving (assuming you don't google the answer). What's wrong with that? –  Kirk Broadhurst Feb 23 '11 at 11:28

The answers have already been posted, but even if you couldn't find the questions you should be able to figure out their targets.

1.There are eight balls. One of them is defective. 

You have a collection of items, and one has a special quality (it's defective). The only thing that you could possibly be asked is to find that one item amongst the collection.

You've got 8 items, which is 2^3, so take a wild guess and it's almost certainly going to be a divide-and-conquer binary-search problem.

The more interesting problem is where there are 9 balls, and you need to find the special ball with only two weight comparisons.

2.There are three electric birds inside a room, but switchers are placed outside.

I don't know what an electric bird is, but there are three objects. You have 'swiches outside', which means you are able to set some boolean property (on/off) but are not sure of the effect.

Given the three objects and the boolean property, an educated guess is that you will need to consider three-state logic (each of the object / birds should exhibit one of three states). Three state logic is like a nullable boolean - something is 'true', 'false', or 'not really either / indeterminate'.

It would be much better to go through this sort of logic in your interview that rote off the answers that you've read online.

share|improve this answer

I think I exactly know what these questions are.

  1. There are eight balls. All are same weight except one of them is slightly heavier than others. you are given a balance (which has two plates and compare weights) and you have to figure out what ball has different weight by using balance not more than two times.

Answer: Separate 8 balls in to groups of 2, 3 and 3. Balance the two groups of 3 balls and see if one side weighs more. If it balances get the group of 2 and balance the 2 balls to pick the heavier ball. If one of the 3 balls group weighs more than the other 3 balls group, get 2 balls from the heavier group and balance them (this is the second round of balancing). If those two balances, then the other ball is the heavier one. else you know which one is heavier already. :-)

  1. There are three electric *bulbs inside a room, but switches are placed outside.

there are three switches to those three bulbs in another room. You have to figure out which bulb is connected to which switch by changing not more than two switches and you only get to go to the room with bulbs after you do the change to the switches.

Answer: Turn on one switch, Turn on another switch for some time and turn it off(Say after 10 seconds). Go to the bulbs room and tell,

  • the bulb which is switched on matches with the switch I kept turned on.
  • the bulb which is hot(warm) matches with the switch I turned on and turned off after some time.
  • The bulb which is off matches with the switch I never touched. :-)
share|improve this answer

Not sure how much time you have before the interview, but this book has similar puzzles http://www.amazon.com/Would-Move-Mount-Microsofts-Puzzle/dp/0316919160

Start reading the book somewhere in the middle, the second half is more informative.

share|improve this answer
would you mind explaining more on what it does and why do you recommend it as answering the question asked? "Link-only answers" are not quite welcome at Stack Exchange –  gnat Aug 4 '13 at 22:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.