Microsoft Interview Experience (2-3 years Experienced)

Round 1:  I received a call from one of the recruitment firms 1 week before the interviews which were held in  Microsoft Noida Office. The first round was a written round where we were given 2 coding questions and time given was 45 mins.We had to write code on paper.

1.) Given start and end times of people visiting a park find the maximum number of people at any point of time.

Start time   End time

8:30              9:00

8:45              10:00



9:00              11:00

9:15               11:00

https://www.geeksforgeeks.org/find-the-point-where-maximum-intervals-overlap/

2.) Given a stream of 3 kinds of objects say ObjectType ob1, ob2, ob3, arrange them in such a way that equal objects are next to each other or come together.Given a compare() function as shown below:

int compare(ObjectType ob1, ObjectType ob2);

= 0 if (ob1==ob2),

=1 if(ob1>ob2),

=-1 if(ob1<ob2).



Round 2:

After 15-20 mins of evaluation I was called for my F2F interview.

1.)Discussion on current project, he asked me several questions on how the web services are hosted, how do we take care of large number of incoming requests, why don’t we host it on cloud etc.

Then he asked me to design a stack which returns minimum element at any point of time.I explained to him the below solution wrote the complete code for it.He mainly checked for corner cases and error handling mechanisms I used.

https://www.geeksforgeeks.org/design-a-stack-that-supports-getmin-in-o1-time-and-o1-extra-space/

Further he asked me to write all test cases and how will I test my design, how I will unit test my function. Next he asked me to make the class Generic.

He asked one more coding question:

Reverse a linked list in groups of k.

https://www.geeksforgeeks.org/reverse-a-list-in-groups-of-given-size/

It is very important to write clean code which covers all the test cases in short production level code.



Round 3:

1.) Discussion on  current project in detail.

2.)Write a code to find whether a string is a palindrome or not.

3.)Write a code to find whether any permutation of a given string can form a palindrome. I first calculated the frequency of each letter and depending on even and odd length palindrome returned the output.The latter should contain one letter with odd frequency.

4.)Write a code to find which permutation of a string can result in a palindrome.

First create all permutations of a given string and then check which one is palindrome.

5. Design a wall clock which will be displayed on an app. As and when time changes the needles should align their position accordingly.

I created a class diagram for classes Clock, Needle and how they will be related.He asked me what functions I will use, design patterns, whether to use it inheritance or composition and why?

Round 4:

This was the Hiring Manager round he first asked me how did my previous rounds go, I told him where I did really well and where I could have done better.He asked me to optimize the coding question I solved in written round



where expected complexity was O(N).

Then he asked me a coding question where I had to find the second largest element in a BST where I should not traverse the entire tree.

https://www.geeksforgeeks.org/second-largest-element-in-binary-search-tree-bst/

I had to write complete code with proper syntax and covering all test cases without using global variables.

He asked me several questions on skills mentioned in my resume. Why JavaScript is better and can we run two functions simultaneously in JavaScript. What are pos and cons of inheritance and composition I had to give examples. A lot of discussion on this topic, he gave me real life scenario on this.

Further he asked me why do I want to change my job, why Microsoft?

After this round the HR told me that I am selected!! 🙂

Thanks to GeeksForGeeks which helped me throughout my preparation.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.