Let's Start Thinking Together!

I was planning to post my 3rd interview experience with Microsoft... That's when I thought there might be another better idea that is more exciting to everyone... Instead of writing about my personal experience, I'll post some of the puzzles that I was asked during the interview, and I'll give the chance for everyone to answer them, I'm sure that there will always be someone able to answer the puzzle; Because really, if I did it, so can you!

One of the main reasons that I'm going to do that is, this way we'll all have the opportunity to think together, listen to each other, know how others think... It might be one puzzle, but everyone can solve it differently that the other, I'm sure it's very useful for everyone to learn about other ideas, see things in a different way...

You can find part of my MS interview process at First Interview on my personal blog.

I'll not publish your comments immediately, rather I'll wait for a period of time so that everyone can think about the problem... and then I'll publish all the comments at once... Please feel free to send me your suggestions or if you'd prefer that I just write my experience... If no one replied I'll just publish the answer myself hoping that it might be useful to others... Please share your thinking with us... Be useful, let us all learn from each other...

Let's start with Today's puzzle:

The Clock problem:

Write an equation that calculates the angle between the minutes hand and the hours hand in a clock at any given time... Please write down the steps of getting the final equation... That's how you are going to help others... by giving everyone a clear idea of how you think, of how they might think, about other possibilities...

Comments

  • Anonymous
    March 13, 2007
    Each minute on the minute hand is 6 degrees from the upright position.   Each full click(lined up exactly with another number) of the hour hand is 30 degrees.  However, the hour hand is not always pointing exactly at an hour, sometimes it is in the middle.  You can you use the minute hand as a precentage it is to the next number though. Using both these methods you can find the angle between the minute hand and the upright position, and the hour hand and the upright position.  Then to find the angle between you take the abs difference of the two angles. Here is a walk through: 3:56 Angle from upright to hour hand = (3 * 30) + ((56/60) * 30) = 118 degrees. Angel from upright to minute hand is = 56 * 6 = 336 degrees. 336 - 118 = 218 degrees between the minute hand and the hour hand.  

  • Anonymous
    March 15, 2007
    Hany, Simple puzzle... Being: deltaD the final angle; Ph the angle to the hour pointer; Pm the angle to the minute pointer; 30 the distance between the numbers in degrees (360/12) 0.5 the angle that the hour pointer walks each minute passed (30/60) 6 the angle that the minute pointer walks each minute. deltaD = | Ph - Pm | Where Ph = 30 * hour + 0.5 * minute; Pm = 6 * minute; Done :) I'm applying to Microsoft and have personal interviews in April. Do you have more puzzles there? I'd be glad if you could send me some :)

  • Anonymous
    March 16, 2007
    Hey Carlos, why ask for angle as parameter? All what you need is the time, so you get two inputs: Time Now in Hours: H Time now in Minutes: M So let's dive from there. First you need to get the hours position, so it's: Hours_Angle_from_zero = (H * 5 + ((M / 60) * 5)) * 6 And why is this, now you need to know on which point the hours is on now, so to know this you first multiply hours by 5, and since the hours is translated a little bit, then you need a number between 0-4.99 representing the exact location after the hour position, that's why (min/60 * 5), after that you multiply this by 6 as the angle between each two points is 6. Now the minutes angel: Minutes_angle_from_zero = M * 6 Angle between both: Hours_Angle_from_zero - Minutes_angle_from_zero And no absolute because -ve angle means that the angle is measured from the other size, which is simply 360 + the result.

  • Anonymous
    March 17, 2007
    Wow, Thx a lot for the comments, I guess everyone got to the same correct answer of course, but different means... My way of thinking in it was: If the minutes hand rotates 360 degrees to allow the hour hand to rotate only 30 degrees... how much does the minute hand needs to move from a minute to minute? 360 -> 30 6 -> X X = 30*6/360 = 0.5 degree. So for every minute the minute hand moves, the hour hand moves 0.5 degree... And really the rest is easy, you can finish it... @Meshref - I just couldnt really understand you Meshref! what do you mean by commenting on Carlos answers? His answer is correct, he doesn't take the input as the angle, he takes the time as input and then conclude the angle... @Carlos - Well, for sure you'll find a lot of puzzles online... You might also consider reading "How to move mount Fuji" which really contains a lot of puzzles... Consider also reading my tips about Microsoft interview: http://hanysbarakat.blogspot.com/2006/12/microsoft-interview-tips.html Other than that, if I remembered anything else, I'll leave you a comment... Thx.

  • Anonymous
    March 18, 2007
    He said: Ph the angle to the hour pointer; Pm the angle to the minute pointer; I thought from this that he means Ph and Pm are inputs

  • Anonymous
    March 19, 2007
    @Meshref, as Hany said, just a little misunderstood :) @Hany - thanks for the thips, but I don't have enough time to read that book :/  I'm solving another interesting puzzles I found around there :) Regarding your invertiew tips, for sure I had already red it all before coming to your technical blog :D And I'm waiting for the next puzzle! See ya!

  • Anonymous
    March 26, 2007
    I am from Pakistan. I came across your blog a few months back. But at that time blog spot was not allowed in Pak. I have done this puzzle on the acm.uva.es site before. After seeing comments by every one else, i won't repeat what others mentioned. The only thing missing is to find THE SMALLER or the inner angle. You see i drive an equation. And when i input 12:00 in it, it gives 360. The equation is correct otherwise and similar to the ones like given above. This was something which came to my mind when putting test cases. So we should return the smaller angle. This could be done by comparing the resultant angle x and 360-x and returning smaller of the two. I am pretty desperate about MS and failed once in Dec. 2006 in Dubai due to may be bad day, a mistake or two etc. So i am in with all mights now. May Allah enable me to learn at my best and achieve my goals (Ameen). regards, Fayyaz

  • Anonymous
    March 26, 2007
    fayyaz - Thx, and a very good observation... Don't ever lose hope Fayazz... MS interviews are only last for 5 hours max out of your life! Sometimes we are just not at our best at only 1 hours out of these 5 hours... This hour does make a difference... My best friend got accepted at MS as an SDE after failing once, and I also have another friend got accepted after failing twice! Study harder, concentrate on you communication skills... Trust youself, and be optimestic...

  • Anonymous
    April 28, 2007
    Hany I have been reading ur blog for a while and "My best friend got accepted at MS as an SDE after failing once, and I also have another friend got accepted after failing twice!" is the best thing you have posted for me as failed once you are one of my favorites

  • Anonymous
    October 10, 2007
    Hello all, I know Im writing this a long long time after the last post. I too, like Fayyaz failed a MS interview back in December 2006. I really wish someday I will work in Microsoft. I am egyptian and I heard they are coming to Cairo to recruit for the Vancouver Dev Center. Im not going to apply in MS until I finish my masters so that Im ready and willing to go. I solved this problem in a Microsoft Egypt exam. I solved it right el humdulilah and passed the exam. Why have u stopped the puzzles. There are so many, but I would love to hear about the ones you were asked to solve in your interviews...

  • Anonymous
    October 23, 2008
    It is very simple , each mint is 6 degrees , eah hour is 30 degree So , the formula is : ( H * 30 - Mi * 6)

  • Anonymous
    March 05, 2009
    <a href= http://index1.4-suki.ru >motorola ru</a> <a href= http://index2.4-suki.ru >������� icq 6</a> <a href= http://index3.4-suki.ru >����� ����</a> <a href= http://index4.4-suki.ru >����� ��� ����</a> <a href= http://index5.4-suki.ru >������ ����� ����� ������������ ���������</a>