Follow Slashdot stories on Twitter


Forgot your password?
It's funny.  Laugh.

Tech-Interview Riddles 843

An anonymous submitter writes "A computer engineering student at UC Berkeley has made a comprehensive archive of riddles from technical interviews. Very challenging and loads of fun. Also useful for interview preparation."
This discussion has been archived. No new comments can be posted.

Tech-Interview Riddles

Comments Filter:
  • I believe Microsoft was responsible for popularizing the usage of riddles in interviews

    Yes, but they still have not been able to find anyone who can solve the "why does windows crash" riddle!!
  • more info... (Score:5, Informative)

    by onby2000 ( 593621 ) on Tuesday July 23, 2002 @11:53PM (#3942227)
    for more tech interview questions and answers try []
  • by Turing Machine ( 144300 ) on Tuesday July 23, 2002 @11:53PM (#3942228)
    What's up with using this type of question for interviews, anyway? Sure, they can be fun, but they're perfectly useless as far as telling whether someone can actually write solid code. 9 times out of 10, all they tell you is whether the interviewee has heard that one before.

    To interviewers: Do you really think that the answers to these questions don't spread through the entire department within 15 minutes after your first interview? I realize that "knowing the answer" makes you feel smarter than the prospective employee in some sense, but how about actually doing your job for a change?

    • You've got to use the right questions. As someone else has pointed out, there's a great web site called [] that has similar questions. They talk about something called the "aha factor". If something has a high aha factor, then you'll only get it if you've heard the question before. These aren't very useful as interview questions.

      If something has a low aha factor, then it's a useful question even if they've heard it before. The idea is to watch the interviewee's reasoning process, not to make sure they get the right answer. When I interview people, I ask these types of questions. I find it an invaluable probe of their ability to reason and think logically.

      One of my favourites is this:
      "How many trailing zeroes are there on 100! (100! = 100x99x98x97x...x3x2x1)."

      Try it. It's reasonably straightforward to get, but you have to show an understanding of factoring and multiplication to get it. The answer is on if you want to check yours.

      • by cwikla ( 557137 ) on Wednesday July 24, 2002 @03:07AM (#3942844)
        The problem with "light bulb" questions is that people tend to like to come up with their own ones, which usually tend to be crappy, or ones, as earlier mentioned, that someone stumped them on, and now they think they are clever for knowing the answer. Even "technical" questions sometimes fall into this one.

        Some experiences in my past:

        A couple of years ago I was asked: How many gas stations are there in the US?

        My answer: I don't know, I'd probably check a search engine.

        After I insisted that I couldn't come up with an answer on my own, I was informed that they were looking for people who "think out of the box" and only people that hazarded a guess made it to level two interviews.

        I laughed, and explained that if someone I was interviewing made up some bullshit answer with absolutely no backing I'd be afraid that would carry over to their real work and it was a silly prerequisite. Knowing where and how to find an/the answer can be even more useful then making up an unfounded answer. Lots of smart people out there. Lots of stuff already been done.

        Hmmm, come to think of it I never did get a second interview.

        Or the time I was asked to come up with a string hash function. So I quickly threw together a loop just adding all the bytes, shifting some bits each iteration. Simple, not great, not perfect, but a decent 10 cent solution. I was then walked through the "correct" answer that covered, number of bits in byte being used, average word length, etc, etc...and told this was the "correct" answer. Researching later, I believe the solution was either in a Knuth book, or was another Microsoft tidbit. But I'm sure the interviewer would have come up with the solution independently given the same question in the interview...

        Finally, my FAVORITE is being asked some hard technical question. You ponder, you falter, and come up with some sort of a solution, but aren't quite satisfied it. Of course the interviewer then informs you it's a problem they are currently working on and they are trying to come up with something themselves. Seems like you should be paid contractor rates at least for that part, no?

        I find that having people talk about their work, explain what they did, and WHY they did it pretty much can measure a candidate against your bullshit meter in a matter of minutes.
        • In 1998 I was interviewed by the Technical Director of a small company in the UK. Their standard tech question was "write a function to rotate a monochrome bitmap". The idea was not to come up with necessarily the correct answer (as if there was *one* correct answer), but to see how you tackled the problem. The only problem with that particular question is that there was a danger that some otherwise perfectly adequate programmers would freeze like a rabbit caught in headlights.

          OTOH I've never seen a company with a higher concentration of good programming skills.
        • by daoine ( 123140 ) <> on Wednesday July 24, 2002 @10:16AM (#3944119)
          My answer:I don't know, I'd probably check a search engine.

          Funny, I had a similar interview for a question at a consulting company. It was basically another 'estimation' type question.

          My first answer was that I'd check google. They didn't like that at all, saying that they needed to be able to come up with these stats quickly, and that an employee shouldn't have to rely on anything. I said that part of solving a problem is knowing when to NOT reinvent the wheel and using information that's readily available.

          Didn't get a second interview either. Not even a phone call saying thanks for interviewing.

          Personally, I love interview puzzles and riddles. But I HATE people who refuse to accept an answer different from the one they have written down. That's not the point. An interview puzzle's supposed to give you an idea of how a person solves problems...not how quickly they solve it the "right" (*snicker*) way.

        • A couple of years ago I was asked: How many gas stations are there in the US?

          My answer: I don't know, I'd probably check a search engine.

          After I insisted that I couldn't come up with an answer on my own, I was informed that they were looking for people who "think out of the box" and only people that hazarded a guess made it to level two interviews.

          It sounds like the interviewer remembered a typical "impossible" question, but forgot why you ask it. The purpose isn't to think out of the box, the purpose is to examine problem solving skills with a problem the applicant has never seen before. Sure, you don't know anything about gas station density in the US, but you'll eventually be required to answer a question you don't really know anything about. "We've been asked to implement a simple web browser that will run on an embedded system that doesn't exist yet. Give me an estimate for how long it will take." It sucks, but you're going to need to do it.

          Because most engineers are loathe to pull estimates out of thin air, it's only fair to explain that you're only looking for a very rough estimate. If the engineer continues to resist, explain that you know he doesn't have good input to work with.

          That said, your answer, "check a search engine" isn't that bad of a place to start. (That's what reference materials are for!). When you're told that it's a good place to start, but that it's not an option, start making up numbers and guessing. Make it clear when you're guessing at numbers. "Well, there are about 300 million people in the US, about half don't have cards, so 150 million cars. You typically get gas once per week. A gas station can serve 100 people per day. That's 700 people per week, or about 1,000 for ease of doing the calculation. So you'll need about 150,000 gas stations." I promise that I pulled that answer out of the air. I have no idea how many people are in the US, let alone any of the other numbers, but I'm pretty sure that I'm within an order of magnitude. In fact, quickly searching the web it looks like I'm very close [].

          Similar logic can get you surprisingly accurate numbers for the volume of water that flows out of the Mississippi each minute, the number of malls, police stations, high schools in the US, or other seemingly hard to know things. Just take what you do know and make educated guesses.

          The string hash function was just stupid, although it might have helped to ask the interviewer what properties he wanted out of the hash. In general, bouncing questions about the problem off the interviewer looks good and can often make the solution easy. The question does sound like an esoteric knowledge question, and those are the worst.

          Being asked to solve a tricky technical question? Well, it's a legit, real problem. It's a fair way to gauge your problem solving ability (did you stumble across the same things they did? Good. Did you suggest something new? Great.). I wouldn't worry about their "stealing" your answer. If the problem really is hard, it's unlikely in the ten or twenty minute interview question that you'll find a superior answer to them.

      • I only ask one "tech" question when interviewing prospective programmers:

        void echo(void)
        char *s;

        What is wrong with this code ?

        The scary thing is, over 50% of the people I ask can't answer it.
    • Those points are true if you're hiring a contractor to come in, do a job, and get out. They are not true if you're hiring a flexible team player who is going to handle a demanding job which is guranteed to throw new challenges on a daily basis.

      If you're hiring the latter type of person, you want to know how they'll react to not knowing the answer in a high stress situation. I've done a lot of interviewing for sales engineering positions, and I can tell you some good ways to not get hired when this question comes up:
      a) lie, convincingly or otherwise
      b) go silent
      c) act like a teenager trying to ask for a date.

      The proper response for me at least is to say "I don't know, but based on these things I do know, this is what I think." I choose people for the way they think in addition to what they know, because that tells me something about what they'll be able to learn.

      That said, most interviewees never make it to a question like that because they get stumped on my initial tech question after "how are you and where did you work before":

      "Describe in as much detail as you are comfortable using exactly what happens from a network perspective when you use that laptop to visit a web site. I'm looking for which packets go where."

      If you tell me about ARP, DNS, and HTTP and you can name the port numbers and transport layers, that's fine. DHCP, load-balancing, firewalls, SSL, proxy servers, server-side processors, databases, that's all extra credit. If you can't talk about these things, you're not yet ready for a professional career in this industry.
      • by MisterBlister ( 539957 ) on Wednesday July 24, 2002 @01:15AM (#3942558) Homepage
        If you tell me about ARP, DNS, and HTTP and you can name the port numbers and transport layers, that's fine. DHCP, load-balancing, firewalls, SSL, proxy servers, server-side processors, databases, that's all extra credit. If you can't talk about these things, you're not yet ready for a professional career in this industry.

        'this industry', meaning network admins who focus on web sites only, right? Not admins or programmers in general?

        Because I'd have an easy time talking about all of that stuff, but I know people as or more intelligent than I am that wouldn't simply because they haven't been exposed to any of that directly.

        It seems to me your question is flawed. You're asking too much about details that can be learned by any intelligent technical individual in a matter of days. Just because they don't know the answer when you ask it doesn't say shit about how good they might be at the job, especially if the job is something more than simple web admin.

      • by pongo000 ( 97357 ) on Wednesday July 24, 2002 @11:11AM (#3944504)
        Those points are true if you're hiring a contractor to come in, do a job, and get out. They are not true if you're hiring a flexible team player who is going to handle a demanding job which is guranteed to throw new challenges on a daily basis.

        Please. Do you really think some silly-ass riddles will separate the wheat from the chaff? In a previous life, I was an air traffic controller (9 years). I was thrown new challenges several times an hour. I don't recall riddles being asked on my interview.

        I can tell you, however, that the three months of indoctrination in Oklahoma City was a head game unto itself. The point being it took three months to sort the psychologically strong from the weak. I seriously doubt a few puzzles on an hour-long interview is going to tell you much of anything.
    • True, while these questions do not answer "Can this candidate code well?" they can provide insight into how the candidate thinks. They are merely "thinking" questions and are only useful if the candidate thinks outloud. It lets you see how they think and how they attack a problem. Are they being logical? If they can logically put several thoughts together, they can code in most any language. Learning syntax is a given.

      - MayorQ
      • Would you guys feel comfortable going to a lawyer or doctor who'd been hired on the basis of his answer to a bunch of "brain teasers", or would you opt for the doctor or lawyer who'd, oh, I don't know, actually been asked questions about law and medicine?

        Asking about TCP/IP is fine. Asking about sorting algorithms is fine. Asking "how would you lay out a data structure to represent this problem?" is fine.

        Asking goofy questions about the shape of manhole covers is idiotic (especially since the "official" answer to that question is dead wrong).

    • by Samrobb ( 12731 ) on Wednesday July 24, 2002 @12:30AM (#3942384) Homepage Journal

      A friend of mine refers to these as "bright bulb" questions. OK, you've demonstrated your grasp of C/C++ or whatever other skills we're primarily interested in hiring you for. These questions are there to give an interviewer some insight into whether or not you can think through abstract problems... how you anser them helps answer questions the interviweer has about you, like:

      • Are you creative?
      • Do you assume non-technical prolems are trivial or uninteresting?
      • When there's no obvious answer, do you give up?
      • Will you ask for more information?
      • If it's not provided, do you take a stab at solving the problem anyways?
      • How do you go about solving the problem (back to front, front to back, middle outwards)?
      • Do you eliminate obvious incorrect answers first, or try and find a logical starting point?
      • If you come close to an answer, do you try to handwave away part of the solution?
      • For some problems, do you see the obvious parallels with algorithms/problems you've encountered in CS?

      Yes, you can answers these sorts of things by asking technical questions... but in that case, you're often trying to evaluate so much - skill set, facility with a language, natural ability, problem solving, thinking pattern, creativity - that it's reasonable to remove the technical aspect and focus on straight problem solving methodology and ability.

      Finally, as an added bonus... anyone can ask these sorts of questions. Your HR person, the VP of engineering, a product manager... anyone. So you don't neccesarily have to give up time in the core technical interview sessions in order to ask these sorts of questions.

    • by realgone ( 147744 ) on Wednesday July 24, 2002 @12:33AM (#3942394)
      I know this is going to sound a little flamebaity; I do apologize for that in advance. But IMHO, when an interviewer falls back on riddles or, worse yet, the "what's in the invisible box" type questions, it reflects either a lack of effort or interviewing skill -- maybe even both! -- on her/his part. Honest, those old hoary chestnuts are like the SAT scores of the job world: indicative of something, but god only knows what.

      Do you want to know if someone has strong logic/reasoning skills? Talk to them about past projects and how they've dealt with the inevitable problems and challenges that crop up. Look for those key details that show they're telling the truth; fakers are usually pretty easy to spot. Want to see examples of creative thinking? Ditto. Take the time to engage folks in regular conversation without resorting to gimmicks. You'll be surprised.

      It goes without saying that I've refused to break out riddles and the like whenever I've been in the position of hiring new staff. There's absolutely no reason to make the whole process seem like a bad Q episode of Star Trek TNG.

      • Honest, those old hoary chestnuts are like the SAT scores of the job world: indicative of something, but god only knows what.

        Even moreso, now that there's a study guide available on the web...
      • I fully agree. (Score:2, Interesting)

        by Anonymous Coward
        I've hired lots of technical talent and never had to resort to this sort of nonsense.

        First, few people can walk into an interview situation and "think" at anywhere near their native capacity. Nor will they demonstate anything near those behaviors they will on the job. Unless, of course, they've had practice -- and that's "bad" from the start.

        I feel stupid employment tests/riddles/processes indicate a complete lack of honesty and integrety on the part of the Company. It's an "in your face" abuse of the power the interviewer has in the process. A hiring manager will likely speak with dozens of people for a single job, their HR department will speak to hundreds, even thousands. It's just too easy to "refine" your process into absurdity, and letting this happen is a more a sign of your own weakness in Corporate people skills, than any lacking on the part of a candidate.

        Anyway, for 'C' the only technical question I've ever asked has been....

        1) X.Y
        2) X->Y
        3) X[Y]
        4) (*X).Y

        Compare and contrast...

        Fully 50% of the best programmers (8 of 15) I've hired failed our "Corporate" tests. All of them were able to answer the above, right away. Yet, somehow, my development group is a "name brand" inside the Company.

        The ONLY thing that matters is a strong generallized aptitude, and interest, in Computer technology. The rest will take care of itself if the candidate has aptitude and as little as 30% of your specific technology or industry exposure. Fairly rare, that aptitude thing, but oh so few managers out there are skilled enought to identify it.

        So, they use "tricks", "riddles", and "magic" to give meaning what is obviously a bankrupt system of human-to-human interaction.

        Remember, most managers got to where they are because they weren't very good technically. So, they had spare time to make themselves useful in more managerial ways. Ever hear the one... "Techies just can't be managers"? Not true everywhere, but you see the jist. The critical mass of "managers" out there don't understand systems, or the technology that drives them. So they resort to clever devices in an attempt to "impress" future subordinates.

        Trouble is, if you're on to them -- they don't want you around.
        • Re:I fully agree. (Score:3, Interesting)

          by sadcox ( 173714 )
          First, few people can walk into an interview situation and "think" at anywhere near their native capacity.

          At my current job, the interview process was very different and very refreshing. After about an hour of discussion about my experience and the skills required for the job, I was invited to come in and spend a few hours working with the project manager on a specific problem. I was paid at a very fair rate for this time.

          This gave me a chance to get out of a "interview" situation and into a "work" situation. It also gave me the opportunity to learn more about the project and the work environment at our company. I thought it was a pretty cool and smart way to do an interview before making a hire or accepting a position.
  • by C.U.T.M. ( 595268 ) on Tuesday July 23, 2002 @11:53PM (#3942232)
    Microsoft question: "Explain a scenario for testing a salt shaker." Too bad Microsoft will probabbly change all of their riddles now. Still very interesting.
  • by SlugLord ( 130081 ) on Tuesday July 23, 2002 @11:55PM (#3942239)
    I sampled a few of the "relatively hard" puzzles... They're interesting, but they only take a minute to figure out. Am I correct in thinking that these are relatively easy, or am I being an ass and flaunting my ability to solve little puzzles?

    (In case of the latter, do you want to hire me? I live in Cleveland and go to Cornell University...)

  • One of my favorites (Score:5, Interesting)

    by Reality Master 101 ( 179095 ) <`RealityMaster101' `at' `'> on Wednesday July 24, 2002 @12:00AM (#3942258) Homepage Journal

    I used to put this one on my programming tests. It's actually shocking how many people get it wrong...

    You are writing a parser that reads a C program and translates all the variable names into new names of the form "VAR######", where ###### is an integer incremented for each unique variable name. Discuss what is needed for the case where the C program already contains a variable of the form "VAR######".

    • Doesn't matter, the variable will be renamed along with the others.

      Now I get a gold star right? ;)
    • by gmack ( 197796 )
      Is the answer .. nothing?

      You shouldn't have to special case that since it's just another variable name.

      • You the man! Here is your honorary degree.

        Now, for this honorary Ph.D., answer this question (another one of my favorites):

        You have a 32 bit unsigned integer. You want it to be really reliable, so you store it three times (triple redundancy). Write a subroutine that takes three unsigned, 32 bit integer arguments, and returns a single unsigned 32 bit integer that is constructed by having the bit in each bit-position "vote" for the corresponding output bit (e.g. if at least two of the low-order bits in the passed in arguments are 1, then the low-order bit in the output is a 1).

        Hint: There's an easy, fast way, and there's a hard, slow way. I'm looking for the easy, fast way.

        I actually got this question on an interview once (and of course figured out the right answer :) ).

        • That seems simple enough.

          (A & B) | (B & C) | (A & C)

          If any two agree that the bit is 1, then it gets ORed in.
          • It's simple enough for people who understand bits, but there are a LOT of people out there who don't understand bits and logical operators. Most people write a loop that does it one bit at a time.

            What I like about this question is that it tests whether someone understands bits without being a big "gotcha" question.

            OK, here's another one that I used to test someone's ability to think mathematically:

            Write a subroutine that given month, day and year, returns the day of the week.

            • It's simple enough for people who understand bits, but there are a LOT of people out there who don't understand bits and logical operators. Most people write a loop that does it one bit at a time.

              True enough. The subroutine thing requires too much actual work for me to try my hand at right now. I'd end up looking up the month in an array, getting the number of days passed so far this year, adding 1 if leap year and (month>2), then add year and some constant, and mod by 7.

              Here's a fun one. Without using any temporary variables, how would you exchange the values of two variables?

              Hint: There are at least two ways to do it in three basic instructions.

        • Damn this is so much more fun than the "lets do this the stupid way so when we show you the next function you will see how much it's needed" classes I had. I mught have bothered to continue :P Ohh well I was broke anyways.

          I see someone else got the second riddle)and that is pretty close to what I was thinking of)
        • If the inputs are A, B, and C, then is:


          the easy way or the hard way? It's only 5 instructions (well 9 if you count loading and storing to memory).
        • Karnaugh Maps (brought to you by CSE 120 at ASU):

          Your problem:

          !B!C !BC BC B!C
          0 | 0 0 1 0
          1 | 0 1 1 1

          Answer: BC | AB | AC

          Ta da!
        • Can't you just xor all three numbers?

          return (a^b^c);
        • by Henry V .009 ( 518000 ) on Wednesday July 24, 2002 @02:17AM (#3942742) Journal
          How is the view from the Ivory Tower?

          Here is what actually happens:

          I have 25 minutes to write out the parser. It's 11:35am September 30th, and our guys in marketing promised that C-Checker 5500 would be out in September. If its not finished on time, management will start complaining that we need to double the number of programmers or something crazy like that.
          The hard part of the problem is variable identifiction. Have to look up the standard keywords again and type them in, and make allowance for a couple of other things.
          After finishing that part I've got 10 minutes left.
          Now I zip through with a little routine that takes the first varible it comes across and replaces it and all future occurences of it with VAR#1, and so on.
          So I run my program on the main development project to test it out.
          I press compile on the modified program. Cherchunketa, cherchunketa --- boom! Compilier error messages out the wazoo.
          Who the hell named his loop counter VAR#37534? Goddamn that bastard! Who the hell does something that crazy?
          Now I have 3 minutes to implement the fix. Do I write in the simple check algorithm that all the CS students you managed to trick came up with?
          Hardly, I rename the thing to VARXY750#XXXXXX, and wait for a bug report.

          As for the triple redundancy problem. Before you start going into your ANDs and ORs and wherefores, there are a few things to keep in mind. First off, if its really important, you need some non-local copies. What if there is a hard-drive crash? Or a nuclear war? The internet will still be around even if the main office is a glassed over glowing area in the North Western U.S. If it's important enough for triple redundancy, it's important to survive any forseeable catastrophe isn't it? So now you have to encrypt the numbers coming and going, and sign it, to keep the hackers from fooling you.

          And so what is the easiest way to implement all this? Simple--there is no simple way. It'll take a lot of work. So you might as well throw your computer out of the window and tattoo the number to the back of your hand.
        • Optimize the common case, which usually is if the numbers are identical:

          ; XOR the ints, and OR the result
          (or (xor int1 int2) (xor int1 int3))

          If the result of this expression is 0, just return int1.

          Profiling of course is needed.
    • I've actually written a program that does that. (In Perl, of course.) Do I get bonus points?

      And to be honest, it didn't do anything quite as obvious as "VAR######" Rather it did a (slightly modified) crypt($varname).
  • by bravehamster ( 44836 ) on Wednesday July 24, 2002 @12:00AM (#3942261) Homepage Journal
    Here's a riddle:

    You've just created a new and interesting website. People are intrigued, and you watch your visitor counter tick over rapidly. All of a sudden, your router explodes into jagged flaming plastic shards, and your server starts sending out distress signals on it's LED's in morse code. What has just happened?

  • Riddler (Score:3, Interesting)

    by Anonymous Coward on Wednesday July 24, 2002 @12:08AM (#3942289)
    It's Turing complete. It weeps, it bites, it smiles and it loves. It can be made, it can be had, it can be taken. It was one, it was two then it became sixty two. It needs time, it need paitence it needs to be pruned. When time comes it needs a fourier series to make it look good. What is it?
  • "Write a program that will display a "spiral" of NxN numbers, using constant space (no arrays allowed). For example, here's what the spiral looks like for N=10:"

    And then he displays a spiral that's 11x10 ... nice ...
  • by 0xdeadbeef ( 28836 ) on Wednesday July 24, 2002 @12:16AM (#3942327) Homepage Journal
    A man would like to have safe sex with three women, any of whom may be carrying an STD. Given two condoms, how can he do so, while ensuring that no STD is passed from one woman (or possibly himself) to another (or to himself)?

    This is a common situation on the job. Who says riddles aren't relevant in interviews?
    • A man would like to have safe sex with three women, any of whom may be carrying an STD. Given two condoms, how can he do so, while ensuring that no STD is passed from one woman (or possibly himself) to another (or to himself)?
      Hmm I think your post is the sole reason that the site got Slashdotted.
    • by jred ( 111898 ) on Wednesday July 24, 2002 @12:51AM (#3942469) Homepage
      Ok, I like the other guys' answer, about wearing both & flipping it. But I think that would suck. I don't mind wearing one, but two at once just isn't going to work for me. So I use condom 1 on girl 1, condom 2 on girl 2, meanwhile having sent girl 3 to the store to get more condoms :)
      • by Anonymous Coward on Wednesday July 24, 2002 @03:30AM (#3942893)
        Easy, its just a riddle... Very unlikely to occur in a real world situtation. It seems you guy are actually planning what you would do in such an event!

        "Oh no, 3 horny women and only 2 condoms...Thank god I read slashdot".

  • The MS category has some real toughies, like:

    "y do u think u r smart"
    "y do u wanna work at Microsoft?"

    and a great catalyst for catastrophe...

    "If you could remove any of the 50 states, which state would it be and why?"

    These toughies are gonna keep me up all night!
  • google cache.. (Score:2, Informative)

    by neo8750 ( 566137 )
    here ya go

    Google Cahce is Ace []

  • A stick of incense takes exactly one hour to burn out. Given nothing but a lighter and three sticks of incense, how can you accurately measure 1 hour and 45 minutes of time?
    • Re:Incense riddle (Score:2, Interesting)

      by Anonymous Coward
      Light the first stick at both ends, so it will consume itself in half
      an hour.

      At the same time, light the second stick at one end.

      When the first stick expires, the second stick will have half an hour
      left. But if you light it's other end at the same time the first
      stick expires, the second stick will expire in 15 minutes.

      When the second stick has expired, it will be 45 minutes from when you
      started, and you can just light the third stick at one end to get 1
      hour and 45 minutes.

  • Riddle (Score:3, Interesting)

    by buck_wild ( 447801 ) on Wednesday July 24, 2002 @12:59AM (#3942501)
    What is:
    Greater than god
    More evil than the devil
    Poor people have it
    Rich people want it
    If you eat it, you'll die?
  • This is a great site [] for more information on interviewing at Microsoft. It has some sample questions, study materials and testimonials etc.
  • (and I'm a hiring manager)

    I rarely find that people fall down on the job because they lack intelligence, especially the kind it takes to solve these riddles. Many people don't use the intelligence they have because of laziness, bad habits, or can't communicate what they know. Most people are smart enough to hide this in interviews, too.

    The reason people can't do their jobs, 99% of the time, is they don't play well with others and/or have poor communication skills.

    Give me an above average, hard working, honest, good communicator over that prima donna MIT grad anyday. Don't get hung up on the MIT example, it could easily be Stanford, UC Berkeley, or whatever. The point is that institutions like these select for intelligence, and let's face it high intellegence and good communications skills rarely go hand in hand. It's a beautiful thing, though, when they do. (Lucky bastards!)
  • Answers here (post more):
    Q: Coin in bottle

    A: Simply push the cork into the bottle and shake the coin out.

  • At a fork in the road between two cities, you see 2 people. One always tells the truth, and comes from the city of safety. The other person always lies and comes from the city of cannibals, where they will eat you. They both look exactly the same. You must ask them one and only one question (no compound questions either). What question could you ask to find out which path leads to the city of safety?

    Did they steal this from the Dr. Who "Pyramids of Mars" episode, or was it the other way 'round? Anyone know?

    Also, pretty sure I figured this one out, but have no college math, & would appreciate a more technical answer.

    You are standing at the start of an infinite sequence of quarters. Someone tells you that 20 of them are tails and the rest are heads. He says that if you can split the quarters into 2 piles where the number of tails quarters is the same in both piles then you win all of the quarters. You are allowed to move the quarters and to flip them over, but you can never tell what state a quarter currently is (i.e. you are blind and you cannot feel which side is heads and which side is tails). How do you partition the quarters?

    So, if you flip the first 20 coins, and partition between 20 and 21, you have the best chance for success, right? Doesn't that mean that there is a 20/inf. and therefore a 1/inf chance that one of the tails coins is in the first 20?

  • by wirefarm ( 18470 ) <> on Wednesday July 24, 2002 @01:39AM (#3942634) Homepage
    "What will it say in the newspaper about you when you die? In effect, write your own obituary:"

    All-time best answer:
    "Gunman shoots nine, then self."

    My friens Marc *swears* he said this in an interview.

    Jim in Tokyo

  • by MillionthMonkey ( 240664 ) on Wednesday July 24, 2002 @01:59AM (#3942689)
    You have a monopoly in a given market. A company creates a groundbreaking product and establishes a new, completely different market. Assuming you cannot buy the company, how do you smash it and extend your monopoly in the old market to the new one?

    How would you go about designing an email client that executes any code that is sent to it?

    If you could remove any of the fifty states (thus rendering federal antitrust statutes inapplicable to corporations in that state) which state would you remove and why?

    How would you go about designing an operating system for people who hate computers and who just want to use their machines for pay-per-view entertainment?

    An End User License Agreement (EULA) appears in a window with "I Agree" and "I Disagree" buttons. The text area in which the EULA appears is eighty columns wide. How many lines of text can be included in the EULA before a computer that just meets your system requirements is unable to load it into memory?

    At a fork in the road between two cities, you see 2 people. One always tells the truth, and comes from the city of safety. The other person always lies and comes from the city of cannibals, where they will eat you. Which one do you hire to write up licensing agreements for your legal department?

    An Arab sheikh is old and must will his fortune to one of his two sons. He makes a proposition. His two sons will use their computers, and whichever computer gets a blue screen of death first will win the fortune for its owner. During the race, the two brothers do nothing on their computers, neither willing to risk a blue screen of death. In desperation, they ask a wise man for advice. He tells them something; then the brothers immediately jump onto the computers and start installing new hardware, sharing files, and downloading hastily written security updates. What did the wise man say?

  • by JamieF ( 16832 ) on Wednesday July 24, 2002 @02:04AM (#3942705) Homepage
    "So there's a programmer writing some code, in C. That programmer needs to use a buffer to store some data. How does the programmer write the code such that an unexpectedly large amount of data doesn't overwrite the stack and result in a remote root exploit?"
  • by Dan Crash ( 22904 ) on Wednesday July 24, 2002 @02:20AM (#3942749) Journal
    Well, I came up with a solution, but somehow it just seems inelegant to me. Any other solutions out there?
    100 prisoners in solitary cells. There's a central living room with one light bulb; the bulb is initially off. Everyday, the warden picks a prisoner at random, and that prisoner goes to the central living room. While there, the prisoner can toggle the bulb if he or she wishes. Also, the prisoner has the option of asserting the claim that all 100 prisoners have been to the living room. If this assertion is false (that is, some prisoners still haven't been to the living room), all 100 prisoners will be shot for their stupidity. However, if it is indeed true, all prisoners are set free and inducted into MENSA, since the world can always use more smart people. Thus, the assertion should only be made if the prisoner is 100% certain of its validity. The prisoners are allowed to get together one night, to discuss a plan. What plan should they agree on, so that eventually, someone will make a correct assertion?
    * SPOILER *


    * SPOILER *


    * SPOILER *


    * SPOILER *

    The rule is: Turn on the light if it's off, unless you've already done this once, in which case, do nothing.

    The day all 100 of you meet, designate one person to turn off the light. Have them count each light they turn off. When they reach 100, they will know everyone else has been out already, and can safely demand their freedom.

    (Of course, assuming the warden really does pick someone at random, he could pick the same person every day, forever. Or not pick one person, every day, forever. Either way, there's no guarantee you're ever getting out.)

  • by SlugLord ( 130081 ) on Wednesday July 24, 2002 @02:32AM (#3942784)
    Some answers from the hard section:

    Criminal cupbearers:
    Let's assume we only have 10 prisoners and that they each drink from up to 512 bottles. Number the bottles from 0 to 999. Prisoner 9 samples 0 to 511. Prisoner 8 samples 0 to 255 and 512 to 999. Prisoner 7 samples 0 to 127, 256 to 383, 512 to 639, etc. (prisoners alternating between sampling and not sampling blocks of wine in decreasing powers of 2 -- prisoner 0 drinks from every other bottle) Now line up the prisoners after onen month and treat corpses as ones and living prisoners as zeros and you have your answer in binary.

    Mysterious Triangle area
    Well, to make a long story short, they're not triangles.

    100 Prisoners and a Lightbulb
    Well if we assume they can all see the bulb every day, they can just toggle the bulb iff this is the first time they've been selected. If the last prisoner has counted the number of times the bulb has been toggled, he can assert that he is the last one to be selected.

    Square Formation
    Move the "notched" piece to teh righth of the current larger square and put the small square piece in the notch. put the larger of the triangular pieces at the top, horizontal edge of the new formation.

    Calendar Cubes
    I like this one. You need all the numbers from 0 through 9 plus 0 through 3. That's 14 faces. You will never need 00 though, so you can remove one of the 0s. Also, you will only ever need the 3 with 0 or 1, so you can remove it from one of the blocks. The solution: the numbers 1-6 on one block, and 7-9 and 0-2 on the other. Yeah it works.

    Mystery Matrix
    4. Entry from row plus Entry from row 2 plus 1 mod 10.

    Fork in the road I
    "is that the city you come from?" If the response is yes, go there, otherwise turn away.

    Fork in the road II
    Assume each person is standing on his respective road. "Is one of you a liar?" Yes means he's a truth teller, no means he's a liar.

    Egg Dropping
    18. Drop from the 10th, 20th, 30th, etc. After it breaks, go back 9 floors and start dropping every floor. You use 18 drops if it can drop from the 98th or 99th floors.

    Greedy Pirates
    It's not apparent to me that this is the intended answer, but "Throw pirates 3 and 4 overboard and divide up the rest between 1,2, and 5. Pirates 1 and 2 will agree to the largest share, and pirate 5 always has a say after that, since 3 and 4 can't agree to anything, so he's needed for the majority.

    Hmm, well it's getting late so I'll just do one more:
    Card Game
    Bob takes any card over 9. The probability that none will show up is roughly .2 with an average payoff of $5. That means that the probability of getting a face card is .8 with a payoff of 11.5. Using more precise figures, i.e. not .2 and .8, the average payoff is about 10.0857 (706/70)

  • by JamieF ( 16832 ) on Wednesday July 24, 2002 @02:35AM (#3942788) Homepage
    Am I the only one who thinks this interviewing technique is retarded?

    Because Microsoft does something most definitely isn't a reason to emulate it. Microsoft isn't exactly known for producing well designed software, nor software that reuses proven patterns or algorithms that solved known problems 20 years ago. Better to hire a bunch of 21 year old college grads who can solve word problems from 8th grade algebra, and pretend that Microsoft invented computers! Whee.

    When I hire developers I want them to be good developers, not promising young interns. My interview questions typically involve technology questions, process questions, some theoretical PROGRAMMING questions, and some social / communication questions. I'm not saying that hiring smart people is a bad idea, but ignoring skills and only looking at generic problem solving ability is a recipe for unbelievably bad code. It's like hiring musicians based on measured hearing sensitivity and reflexes. OK, maybe that matters if you want to figure out which 5 year old is going to be a prodigy, but hand them an instrument and the noise that comes out is going to sound like ASS.

    Examples of things that "smart" developers I've worked with before have totally missed:
    - the existence of more efficient data structures than arrays
    - generalizing code into reusable chunks (functions, objects, whatever)
    - regular expressions
    - the difference between "client" and "server"
    - the reason for using descriptive variable names
    - collection libraries with built in sorting ("whatcha workin' on?" / "coding up a quicksort algorithm" / "in a J2EE app!?!?")

    You can't just get this from reading a book, either, although that definitely helps. You have to have some degree of EXPERIENCE too: at least a few projects, and some awareness of things like performance tuning, security, coding for maintainability, etc.

    I would use these "tech interview questions" only for hiring interns or recent college grads where the expectation is zero experience, zero clue, zero skill, and a correspondingly low salary. After all you're investing in someone. But for someone that commands a market rate developer salary in the high five figures, screw the brain teasers - just spend a couple of hours grilling them on skills, experience, discipline, etc. They will respect you big time in return because they know when you extend an offer that they won't be working with a bunch of dumb-asses who can get the explorers across the river without being eaten by the headhunters but who can't code their way out of a soggy paper bag.

    • by MeerCat ( 5914 ) on Wednesday July 24, 2002 @06:15AM (#3943179) Homepage
      Precisely why companies end up with the wrong employees. My usual answer to these questions is "Sorry, the interview ends here, you failed", or (if I feel like baiting them) to "think outside the box" eg the bridge/flashlight/limited time issue "so, one guy is lighter than the others and they realise they can cross together, or they wait til their eyes adjust to the darkness and they're fine, or they check their watch and realise they have more time than they thought". If the interviewer says "no, wrong answer" I tell them they've missed "the big picture" and they need to "free their minds from the imagined constraints", and then ask them what we're doing next...

      On a similar note, I do NOT want to hire staff who can put a list of obscure C++ operators in order of precedence, I want to hire those who say "well, I'd look it up if need be, but to make sure the next guy reading my code doesn't get confused I'd simplify the expressions with braces"... bingo - instant pass !

      Interview questions should be open, not closed.

  • rec.puzzles (Score:3, Informative)

    by valentyn ( 248783 ) on Wednesday July 24, 2002 @02:49AM (#3942815) Homepage
    There are lots of these sorts of puzzle sites. One of the older/more famous is the rec.puzzles archive. Find it at here [].

    Another good resource: the Princeton Mathclub []

  • Infuriating,,, (Score:4, Interesting)

    by Grape Shasta ( 176655 ) on Wednesday July 24, 2002 @02:53AM (#3942825) Journal
    The thing that drives me nuts is not having the "right" answer to check my answers against. Look at this one, for example:

    willywutang is hanging out on a heavily forested island that's really narrow: it's a narrow strip of land that's ten miles long. let's label one end of the strip A, and the other end B. a fire has started at A, and the fire is moving toward B at the rate of 1 mph. at the same time, there's a 2 mph wind blowing in the direction from A toward B. what can willywu do to save himself from burning to death?! assume that willywu can't swim and there are no boats, jetcopters, teleportation devices, etc.. (if he does nothing, willywu will be toast after at most 10 hours, since 10 miles / 1 mph = 10 hours)

    There's many possible answers, so how do I know if I've got the answer they want? He's in a heavily forested area, so grabbing a log and paddling out around the fire shouldn't be hard. Or he could dig a little moat, though that might not be too effective. So, is there some other, clever answer, I should look for, or am I done? Grrrrrrrrr!

  • Real-world questions (Score:3, Interesting)

    by Animats ( 122034 ) on Wednesday July 24, 2002 @03:24AM (#3942881) Homepage
    • Explain why the stock market just crashed, outline the expected future of the economy for the next year or two, and indicate a general strategy for the company for this difficult time.
    • Will Microsoft's new approach to security work? Why or why not?
    • Based on recent news events, what level of effort should be applied to defending against info-war attacks?
    • Should we port to Itanium, Sledgehammer, or neither?
    • In an environment of Windows and Mac desktops, and Linux servers, what are the major integration problems?
    • How can we avoid an SPA audit?
    • We'd like to cut the load on our web site servers in half without losing any revenue. What should we do?
    • Historically, what copy-protection systems have worked successfully? Why?
    • Should we use C#? Why?
  • by g4dget ( 579145 ) on Wednesday July 24, 2002 @04:02AM (#3942956)
    Yes, these questions look exactly what Microsoft optimizes for: employees who are really "smart" in a Mensa-sort-of-way. Too bad that programming isn't about being "smart", it's about craftsmanship, taste, engineering tradeoffs, tradition, experience, and long-term dedication. And, not surprisingly, those are areas where Microsoft is sadly lacking.
  • by mgblst ( 80109 ) on Wednesday July 24, 2002 @04:18AM (#3942988) Homepage
    This site contains answers to many of the microsoft questions. ?a ction=topics&number=3

    i suppose the answer to many riddles is, look it up on google?
  • Argh! (Score:3, Funny)

    by Chris Johnson ( 580 ) on Wednesday July 24, 2002 @05:38AM (#3943130) Homepage Journal
    *probable spoilers, only without workings* Anyone else having this problem? With certain puzzles, I'm struck forcefully with an answer but I can't (currently) come up with the rationalization to show it is unarguably correct.

    For instance: Brown Eyes and Red Eyes. I have this sense that upon being told by the outsider 'at least one of you has red eyes' (no top limit to the number), ALL the monks go commit suicide at midnight. I can see they still can't communicate, and can't prove they're not among the not-red-eyed, but there are links in the logical chain missing here- yet it points to that result somehow, due to their non-self-awareness and the confirmation that there are red-eyes present.

    By the same token- The mother is 21 years older than the child. In 6 years from now, the mother will be 5 times as old as the child. Question: Where's the father? I have to say: on top of the mother, conceiving the child- but I can't get the numbers to add up to anything sensible, it's just the only intersection that would give you the location of the father! *rrrrr*

    And finally, 0.999999... is not 1.0000000.... really it's not, though in practice, well...

  • by rufusdufus ( 450462 ) on Wednesday July 24, 2002 @06:59AM (#3943264)
    I did a lot of interviews at MS when I was there, and I quickly learned not to ask riddles. First off, it makes people who don't get them uncomfortable and angry. Second, it doesn't actually show that the person can write software.

    I used a much simpler approach, so simple most people think its silly. But thats the point; nobody leaves the interview thinking they were tricked or duped. I always started with implementation of strcpy(). Half of the candidates failed right there! They took most of the hour to get it right (or not), but were able to see point-blank that they were not ready for the job.
    Next, I would ask about crashing cases, and if they figured out overlapping memory locations, have them write a 'fixed' version. This weeded out another big chunk. After that, I went into some color counting algorithms.
    I stayed well withing the field of what the candidate would expect, and did not try to trick him or make him nervous with off the wall riddles.

    This approach worked great, and didn't leave anyone feeling robbed and abused. The ability to solve riddles *is* an indicator of how smart the person is, but it is *not* an indicator of how good a programmer they will be.

In the realm of scientific observation, luck is granted only to those who are prepared. - Louis Pasteur