Microsoft interview questions

  1. These three riddles appeared during a certain Microsoft job interview.
    The interviewer would watch how the interviewee responds to these riddles. Even if they didn't get the answer, the interviewer wants to see how they think as they explain the steps they're making to TRY to solve it. Some might be too easy to solve directly! See if you can solve these.

    Riddle #1:

    1
    1 1
    2 1
    1 2 1 1
    1 1 1 2 2 1
    3 1 2 2 1 1

    What's the pattern?


    Riddle #2:

    You have four people at a bridge... one HAS to carry a flashlight as they cross, but only two can cross at a time. And nobody can go alone.

    It only takes one 1 minute to cross. Another takes 2 minutes. Another, 5. And the last, 10.

    If the person who takes 1 minute goes with the person who takes 10... it automatically takes 10 minutes.

    How many minutes will it take them all to cross.. at the quickest?

    Riddle #3:

    You have two fuses... they burn at different rates and not at steady rates. BUT! They only burn for one hour. One could burn the entire way except one inch within one minute, then spend the last 59 on that last inch, for example.

    You also have to use this to somehow time 45 minutes exactly. How would you do it?
     
  2. jcsd
  3. 1

    1 3 1 1 2 2 2 1

    2

    18

    3

    Ignite string A on both ends, string b on one end. When string A burns out, ignite string B on both ends.
     
  4. 2.
    17

    -- AI
     
  5. Where are you getting your answer of 17 or 18 for question 2??

    This is my answer and reason...

    19 Min

    1&10 cross 1 comes back 11min, 5&1 cross 1 comes back 6 min, 2&1 2 min = 19 min


    How can it be done faster?
     
  6. how does one get the pattern for 1?
     
  7. 12 minutes. 10 & 5 cross, =10 minutes then 2 & 1 cross =2 minutes
     
  8. Oh ofcourse, they throw the flashlight from one end to the other, how in the world i didnt think of this :wink:

    max(1,2)+min(1,2)+max(5,10)+min(2,5,10)+max(1,2)=17
    Sorry if i am cryptic, but this was supposed to be a brain teaser :wink:

    -- AI
     
  9. Why would you assume there is only one flashlight? Post said A flashlight not THE flashlight. If not two would have to cross and then two cross back (if one can't cross alone one shouldn't be able to cross back alone) and all 4 would never all get across
     
  10. Point taken and understood. But then it wouldnt be much of a brain teaser would it be?

    quoting the question,
    Only two can cross at a time
    I believe this means, "at the max only two people can cross at one time" and not "exactly two people should cross the bridge at any instant".

    -- AI
     
  11. very clever tenai...but then by your logic..it would only take 10 mins.

    i guess it all depends on your take of "noone can go alone"

    oh and could you plz tell me or hint to solve 1...
     
  12. Really :confused:

    Google for Conway sequence, its one of the well known sequence and according to one paper (which is not freely available unfortunately) this sequence has many interesting properties.

    -- AI
     
  13. Tenali, are you saying this?

    The 1 minute person has the flashlight. 1 min + 10 min cross, then 1 min + 5 min cross, then 1 min + 2min cross. = 17 mins. Now when I say 1 min + 5 min cross, I mean that 1 min is coming back to the start while 5 min is going to the end.

    Probably easier to see in this image: http://img11.imageshack.us/img11/28/msquestion3oa.gif
     
  14. There is no trick to breaking the rules- two people max, both same way, one flashlight. The trick is to illiminate the bad affects of the 10 and 5 person- think of the farmer, the fox, the chicken, and the egg riddle if you know it...

    3) light one rope at both ends
     
  15. Err nope,
    (warning : spoiler)

    Assume a,b,c,d are on the left side.
    Objective -> a,b,c,d to go to right side in minimum time
    Constraints -> Just one flashligh, flashlight necessary to cross and bridge can balance at the max 2 people
    a(1 min,flashlight),b(2 min) go right --> 2 mins
    a(1 min,flashlight) goes left --> 1 mins
    c(5 min,flashlight),d(10 min) go right -> 10 mins
    b(2 min,flashlight) goes left --> 2 mins
    a(1 min,flashlight),b(2 min) go right --> 2 mins
    Total -> 2+1+10+2+2 = 17 mins


    -- AI
     
  16. this was my solution..i'm not gonna white it cuz its a matter of the way you interpret the question. 10min carries flashlight.5+2+1+1+1=8 = 10.
     
    Last edited: Jul 14, 2005
  17. (Agreed, but it was the 'nobody one can go alone' line that, for me, ruled out someone crossing either way alone. Hmm, perhaps 'go' may be just mean 'go' and not 'come back'. Two people on the bridge at the same time, even if one's crossing leftward and one's crossing rightward may be legal to the rules as I saw them though.
    The 3rd line implied to me that the faster person must walk slow to actually stay with the slower person, i.e. hand in hand.

    Knowing other puzzles on this board maybe one of the crossers is named Nobody!
    )
     
  18. Oh well, poorly defined question, yeah probably. I guess, your solution stands good given that the concerns you have raised seem appropriate :smile:

    -- AI
     
  19. I didnt notice the nobody can go alone line but if that were true the question would be impossible.
     
  20. ^ Yes exactly! That is why I think one comes back, with the flashlight, while another crosses at the same time. They are not together, but they are crossing the bridge at the same time.
     
  21. BobG

    BobG 2,346
    Science Advisor
    Homework Helper

    Tenali, you solved the problem as it should have been written. You didn't read the way it was actually written closely enough.

    "You have four people at a bridge... one HAS to carry a flashlight as they cross, but only two can cross at a time. And nobody can go alone."

    As written, it pretty much makes the problem unsolvable unless you either have two flashlights or get to throw the only flashlight.
     
Know someone interested in this topic? Share a link to this question via email, Google+, Twitter, or Facebook

Have something to add?
Similar discussions for: Microsoft interview questions
Loading...