Microsoft Interview

This post is not about the questions as such in my Microsoft interview but how to get prepared for a Microsoft interview purely from my perspective.

1. Preparation

Preparation is a key thing for any interview, be it with MS or any other company. Know the fundamentals well. Books which I read/recommend are my academic text books “Introduction to Algorithms” well known as CLR or Cormen and “Algorithm Design” by GoodRich and Tamasia.

2. Coding

Very Very important. Every company asks you to write code. At MS interviews what I found is people expect you to write a bug-free/optimized code that actually works for the question asked. [Yes, its same everywhere]. Here people expect you to write a production quality code. The interviewers will not be happy if they find a bug/error in the first look. Make sure to check all the boundary cases, input (params) validation, ofcourse the main thing is the logic/algo.

Practise some coding questions before coming to interview. I would recommend practising on a piece of paper, then cross check it with some test cases and then input this code in your favourite editor, compile/run and make sure its working as expected. Doing this way for some questions gives you the confidence and then onwards it would be sufficient to practise on a paper instead of spending time on typing in an editor.

I would suggest you to run your code through some test cases before submitting your code to the interviewer.

Before getting started with the code discuss your approach with the interviewer, if you are into a wrong path they might guide you to a proper path.

3. Understand the problem

First thing is do not make any assumptions, even if you make any communicate it properly. If you find any ambiguities get them clarified. There is no point answering to a question which you do not understand [what are you solving there!].

An important thing, people here are very smart/intelligent. So just don’t try to blabber some non-sense stuff.

4. Other

Have a proper sleep before the interview day. Have patience, its definitely going to be a long day. Have good lunch during the lunch break. No point in fainting in your last round 😛

I will be very happy if some one can add any valuable inputs in the comments.

I will write about my WOW-Experience of joining Microsoft in a new post 🙂

VMWare Interview Process

Since my college days I have been thinking of getting interviewed with VMWare. Luckily I got a chance recently for the first time. I was very excited when I received a call from VMWare HR. (Surprise!!). When the HR called me, she asked me for a time to schedule the first telephonic, apart from asking for a time slot, I was asked some technical questions as well, like Differences between threads and process, different ways of initializing a thread in Java, differences between stored procedures and functions etc. I think I was able to answer all of them well, at the same time I asked my self, is that really HR or Hiring manager 🙂

The main things that are concentrated in my interview process with VMWare are:

1. Multithreading/Synchronization/race conditions

2. Core Java

3. Serialization concepts

4. Design Patterns

5. Algorithms and coding

6. Trouble shooting

etc. are the ones to mention

Over all I had one telephonic, 3 face-to-face interview and 3 telephonic interview with people from Palo Alto. It was truely an amazing experience. The people are really good and the HR used to provide updates very quickly, I mean to say even before I think of giving them a call I used to get a call from them about the status.

Result : Offer!!

ThoughtWorks Interview process – Part 2

After a considerable amount of time TW got back saying my assignment has been accepted by the interview panel and asked me to come over to their office for face-to-face interview discussion.

In the office I had the following rounds:

1. First one is a code pairing round. In this round you will be asked to explain your assignment logic and then you would be provided with an extension to the problem you solved. The good thing I have done is I took care of the extension already in my submitted solution :). The one who took the interview was awesome at design. Was giving me pointers every time on how the design can be improved. Enjoyed this pairing round.

2. Then you have a aptitude test which contains 11 questions [one question has 2 parts]. The questions need a lot of concentration [seriously]. You will be given 2 sample questions with solutions at the beginning of the test. Solve them to get an idea of the questions. I scored a 11/11 here [I asked the HR for the score].

3. Next you have a interview panel discussion. Here I was interview by 2 people. This one went really well. They wanted me to be very clear at every point I said so as to make sure I know what I am speaking.

4. The last one, here you will be given 50 questions which you need to answer in 12 mins. You will be said some rules before the start of the test. You do have negative points.

If the things go well, you meet the GM. You will have a discussion with him. Finally you will be asked to take a predictive index survey.

Overall, the interview experience is very good. People are good, interview process looked a bit different/unique compared to a traditional process. They said they would roll out an offer!

ThoughtWorks Interview Process – Part 1

I have applied to ThoughtWorks (TW) from their job portal. The process starts with a Coding Assignment (will explain details in a while). If they are satisfied with your solution, they would invite you onsite. In the office you have a written test, one code-pairing round, then an interview panel discussion, then a written test and if things go fine you meet the General Manager.After all these things you will be asked to take some predictive index survey. Thats it!! 🙂

Let me explain things a bit in detail.

1. Coding Assignment:

After the resume screening, the HR will get in touch with and mail you the assignment problem and gives you enough time to send them the solution.

You will be sent two coding problems : One is the famous “Mars Rover” Problem and the other is “Sales Taxes” Problem. You can solve any one of the problems. I choose to solve the Mars Rover problem since it looked a bit interesting to me. [I am not pretty sure if solving both the problems has any advantage!].

Since I was kind of very occupied with my work, I worked over the Mars Rover problem on a friday night and mailed them the solution.

Things to consider when you are working on the assignment:

1. The problems given for the assignment can be solved using procedural programming in just 1 or 2 hours may be. But TW wants you to give more focus on the Design aspect.

2. Have a proper packaging structure, Exception handling, Test cases, boundary conditions. Importantly a proper documentation of the code. This should be something like you can ship it [I made this up :P]

PS: Everything I said here is from my perspective.


A squad of robotic rovers are to be landed by NASA on a plateau on Mars.
This plateau, which is curiously rectangular, must be navigated by the
rovers so that their on-board cameras can get a complete view of the
surrounding terrain to send back to Earth.

A rover’s position and location is represented by a combination of x and y
co-ordinates and a letter representing one of the four cardinal compass
points. The plateau is divided up into a grid to simplify navigation. An
example position might be 0, 0, N, which means the rover is in the bottom
left corner and facing North.

In order to control a rover, NASA sends a simple string of letters. The
possible letters are ‘L’, ‘R’ and ‘M’. ‘L’ and ‘R’ makes the rover spin 90
degrees left or right respectively, without moving from its current spot.
‘M’ means move forward one grid point, and maintain the same heading.

Assume that the square directly North from (x, y) is (x, y+1).

The first line of input is the upper-right coordinates of the plateau, the
lower-left coordinates are assumed to be 0,0.

The rest of the input is information pertaining to the rovers that have
been deployed. Each rover has two lines of input. The first line gives the
rover’s position, and the second line is a series of instructions telling
the rover how to explore the plateau.

The position is made up of two integers and a letter separated by spaces,
corresponding to the x and y co-ordinates and the rover’s orientation.

Each rover will be finished sequentially, which means that the second rover
won’t start to move until the first one has finished moving.

The output for each rover should be its final co-ordinates and heading.


Test Input:
5 5
1 2 N
3 3 E

Expected Output:
1 3 N
5 1 E

Interview Question : Print nodes of a Binary Tree level order from leaves to root

I think most of you might know about Breadth First Search (BFS), in which you print nodes of a tree from root to leaves. Now there is a small change to the way the nodes are printed. Lets say given a binary tree, I want the nodes to be printed level order but from leaves to root

Eg :  consider the binary tree at this locations

Now you need to print : 5 11 4 2 6 9 7 5 2

Solution to 2 dice problem

This is the solution to the dice problem in “First technical post!?”

Here you need the sum to be exactly within the range 1-12

So how do we proceed? The total number of possible outcomes with 2 dice is 6*6 = 36. And the total numbers in the range 1-12 is 12, since the probability should be the same, every sum can occur 36/12 = 3 times. is this fine? Now since you need a sum 1, there should be atleast 1 zero and since the sum 1 should appear 3 times there should be 3 zeroes. Now since there should be a sum 12 there should be atleast one 6 on the other die, since the sum 12 should also appear 3 times, there should be 3 sixes too. Now you have 3 zeroes and 3 sixes, so 3+3 = 6, which covers all the sides of the other cube.

If you have any other number other than 0 or 6 on the other cube, the probablity will not be the same!

Survival of the Sheep

Lets solve a logical puzzle.

There is an island filled with grass and trees and plants. The only inhabitants are 100 lions and 1 sheep.
The lions are special:
1) They are infinitely logical, smart, and completely aware of their surroundings.
2) They can survive by just eating grass (and there is an infinite amount of grass on the island).
3) They prefer of course to eat sheep.
4) Their only food options are grass or sheep.

Now, here’s the kicker:

5) If a lion eats a sheep he TURNS into a sheep (and could then be eaten by other lions).
6) A lion would rather eat grass all his life than be eaten by another lion (after he turned into a sheep).

1) Assume that one lion is closest to the sheep and will get to it before all others. Assume that there is never an issue with who gets to the sheep first. The issue is whether the first lion will get eaten by other lions afterwards or not.
2) The sheep cannot get away from the lion if the lion decides to eat it.
3) Do not assume anything that hasn’t been stated above.

So now the question:
Will that one sheep get eaten or not and why?

Courtesy :