• RSS
  • Facebook
  • Twitter

Knowledge is Power.

  • Who you are ?

    Working on machines without understanding them ? Then you should be here..

  • Where you are ?

    Geographical location should not become a barrier to Share our knowledge.

  • What do you do ?

    Puzzles and Interview question are intended to be discussed here.

    Thursday, February 25, 2010

    A very famous Microsoft Interview question : You have two candles. Each burn for 60 minutes. How can you measure 45 minutes using this ?

    Solution :

    lay both the candles together on a horizontal surface, next to each other, but both pointing in opposite direction as shown….
    <=======
    =======>
    now light both the candles….
    when both the flames on both candles meet , exactly half an hour would hav passed…
    now the candles should look like…
    …..…|<===
    ===>|………
    now rearrange the candles…
    ===>
    <===
    now wait until the flames meet…..
    so that the total time elapsed will be 30 + 15 = 45 mins…
    the above solution is assuming that the rate at which the candles burn doesnt change
    with respect to its orientation – horizontal or vertical

    OR
    1.Light the first candle from both the sides and 2nd candle from one side.
    2.1st canlel will finish in 30 min. while 2nd candle will be burnt half way.
    3.Now light 2nd candle from both the sides. It will finish in next 15 min.
    So we have calculated 45 minutes in all.

    0 comments:

    Post a Comment