May 2, 2006

First Interview

Previously: Before Microsoft Interview (Getting Ready)

- "So, you won the 2nd place in the ACM contest?" he said reading my CV..
- "Yeah" I answered.
- "so what did u do in ACM?".
I started talking about the ACM rules and how the contest goes, Then I told him that I was responsible for dynamic programming, recursion, and pattern problems in my team.
- "Dynamic Programming!, So you are good in dynamic programming?" He asked.
- "Actually not that good, Its like I'm a beginner, Its like I know basics and concepts, but still I can solve some dynamic programming problems." I replied.
- "Okay, I have this dynamic programming problem that I need you to answer me, just to know how much u know about dynamic programming, if you don't understand anything please ask me to tell u the question again".


At this point I was kinda afraid from dynamic programming problems ofcourse, and I wasn't that sure I can solve it, yet I was doing my best to be cool and calm.
Then he asked me this: "You have three big jars, each contains a different type of liquid, and you have many customers come to you, each one requests either a type of liquid from a jar, or asks for a mix between liquids in more than one jar".

I did nothing.. In my mind I thought "What!!".. I didn't even knew why this is a dynamic programming problem!!.. I asked him to explain some more, I even asked where is the problem?. "So, you want me to develop a solution that handles this scenario?" I asked. My idea was to keep customers in a queue with FIFO and just give them whatever they need unless they asked for something that is no longer available then they 'll be tomorrow's queue. I was just giving hints and talking with him, I didn't really give him an exact answer, but we just talked about this one.

He then drew a line on the paper saying "Well, forget this problem, now our interview is going to start".
- "You have people standing in a circle" he said drawing nodes on the paper circularly. "After n someone, this n someone is removed from the circle, and then u start counting another n someone from the last u just remove" explaining what he was saying on paper. "Who wil last till then end?" he asked.
I said "that's Josephus' Problem". He answered "Yes, that's good, you know Josephus' Problem?", "Yes" I replied. He asked me about the idea, and to implement the algorithm, that's when I said "I 'll assume that the linked list data structure is already made", So I wont write the implementation code of the linked list. But he said "No, Implement the code of the linked list, I want the whole problem solved from scratch".

I implemented both the linked list and Josephus' algorithm, then he started to take a look at the code with me, he didn't comment on the linked list implementation, but when we got to the main problem's algorithm he asked me "How could you make this code work better?". My answer was mainly about just simple code optimizations that makes the code more easily readable and just saves one or two checks and code lines.
- "Ok, how can you test your code?".
This was actually the key to most of my algorithm implementation failure, I started to tell him test cases, my first couple of test cases were normal test cases just to make sure that the algorithm is running ( and that's the only thing that passed my testing). What if the number n to remove from the list is zero?, what about the list is empty?, Okay, the worst is.. What if the number n to remove from the list is NEGATIVE.. And some others, my implementation was actually handling the basic cases of the algorithm the normal cases, and sometimes it passed some of my cases, but not all of them.

Anyway, he then started to read my CV, he noticed that my graduation project was robot motion planning, so he started asking me about it. I even explained to him the algorithms I used, what I was responsible for in this project?, how did I move the robot in both known and unknown environments, and how I divided my environment into small cells.

Then he asked me about the MCSE course, and how I became MCSA certified, he then asked me about TCP, UDP, DHCP, supernetting, DNS.

That was almost everything in the first interview, Thoughts in my mind were "My first interview went fine, but still I have a long way to go." .

The interview almost took 45 min, and then me and the other four interviees met in our room, where we hanged out, drink some coke and relax for 15 min, I didn't really talk about anything, I was trying to concentrate as much as possible.

My second interview was with a testing manager called Ahmed, when we went on the interviewing room together, the table was in the middle of the room where we sat facing each other, and again a laptop infront of him, some papers and a pencil. One of the HR ( the girl who called me in the phone interview) came to the room with us, telling me that she hopes it wont bother me staying with us, she sat with us for the whole 45 min of the interview taking notes.

To be continued.

5 comments:

Mohamed Moshrif said...

Ohh you forget something really important :)

When you are asked a question like:

You have the time to only try two test cases on your algorithm, what will you pick?!

Most people will try to choose the most rare compinations and the cases that are so rare to see whether they are working or not.

BUT

This is not true, the first thing you must put in your mind, that you haven't done any testing to your code up till now, so if you picked only the 0.1% cases to test and they passed, you got a very big chance that the other 99.9% would fail.

In other words, in this case, just pick the most common two test cases, which usually are two test cases which must work and they test the main problem of your code, as example if your code is just addition function, you need to try some test cases like these:

4+5
10+15

But in general, choose two test cases that one of them you are sure that it will work 100% and the other you sure that it will fail 100%.

As you need to make sure that this code is even runable

Hany Barakat said...

well, I was going to mention in my second interview with the testing manager what happened in details.. alot of test cases and design have been made.. I 'll tell u later.

Anonymous said...

Enjoyed a lot! »

Hany Barakat said...

Thx... Glad u did.

Anonymous said...

That's a great story. Waiting for more. Proactiv risk free trial Cheap hp 78 & 15 ink cartridges domain name register Peter chris scam comp sportsbook treatment cancer farmers 26 mechanics mutual insurance co slot machines history 1982 cadillac seville Didrex drug testing