Logic Puzzle Interview Question at Microsoft

For years, Microsoft has been famous (or infamous depending on your point of view) for asking logic and puzzle questions during hiring interviews.  Although that practice is not as common now as it once was, you still see them every now and then.  Here’s one I heard recently that I liked because seeing how candidates approach the problem gives some insights into their personality.  The problem goes like this: Two friends, a programmer and a mathematician, get together for drinks after work one day at the programmer’s house.  The mathematician asks the programmer how his three children are doing.  The programmer replies that one of his three children just had a birthday.  The mathematician asks, "How old are your children now?"  The programmer replies, "The product of their ages is 36."  The mathematician thinks for a moment and says, "That’s not enough information."  The programmer says, "OK, the sum of their ages equals my house address."  The mathematician steps outside to check the address number, comes back inside, and says, "That’s still not enough information."  The programmer then says, "Well my oldest child has red hair."  The mathematician immediately responded, "Oh, now I know the ages."  What are the ages of the programmer’s three children?


The children are aged 2, 2, and 9 years old.  The mathematician’s logic was that since there are three children whose ages multiply to 36, the possible combinations are:


1, 1, 36

1, 2, 18

1, 3, 12

1, 4, 9

1, 6, 6

2, 2, 9

2, 3, 6

3, 3, 4


Initially, any of these could be the correct ages.  After the programmer says that the sum of the ages is the same as the house address, the mathematician mentally computed the sum of each possible combination:


1, 1, 36 -> 38

1, 2, 18 -> 21

1, 3, 12 -> 16

1, 4, 9  -> 14

1, 6, 6  -> 13

2, 2, 9  -> 13

2, 3, 6  -> 11

3, 3, 4  -> 10


Notice that all the sums are different except for (1, 6, 6) and (2, 2, 9).  If the programmer’s address was anything except for 13, then the mathematician would know the ages, so the three ages must be one of those two combinations.  But after the programmer said that the oldest child has red hair, the mathematician knew that there was a single oldest child which eliminates the (1, 6, 6) combination which has oldest twins.


Combinations and permutations are fundamental concepts in software development, testing, and management.  You can read about their role in testing in the July 2004 issue of MSDN Magazine at http://msdn.microsoft.com/msdnmag/issues/04/07/TestRun.


If you enjoyed this blog entry, you might enjoy working at Microsoft.  My parent company, Volt Information Sciences, is always looking for software engineers.  Check the job listings at http://jobs.volt.com/.




This entry was posted in Miscellaneous. Bookmark the permalink.