# Microsoft Interview Experience (3+ Years Experienced)

**Round 1:**

I gave the straight forward solution and tested it in codility. Traverse first to get the length of the Linked list, and then traverse again to reach the n-k th element that needs to be removed. He asked for a better solution. Even though I could not come up with it, he only explained the approach (2 pointers).

Then we had some discussion about https://leetcode.com/problems/fizz-buzz-multithreaded/. I did not give a complete explanation, I talked about how the semaphore and locks concept can be used to solve it.

**Round 2: **The interviewer was friendly, and he clearly told the expectation is not the syntactically correct code, but structure and logic. He asked me to write very small methods initially, then eventually I wrote the below code.

MyClass maxValue(List<MyClass> arr){ MyClass max = arr[0]; for(int i=1;i<arr.size();i++){ if(!MyClass.greaterThan(max,arr[i]) ) max=arr[i]; } return max; } MyClass minValue(List<MyClass> arr){ MyClass min = arr[0]; for(int i=1;i<arr.size();i++){ if(MyClass.greaterThan(min,arr[i]) ) min=arr[i]; } return min; } void bothValues(List<MyClass> arr){ MyClass max = arr[0]; MyClass min = arr[0]; List<MyClass> maxList = new ArrayList(); List<MyClass> minList = new ArrayList(); for(int i=0;i<arr.size()-1;i=i+2){ if ( MyClass.greaterThan(arr[i],arr[i+1]) ){ maxList.add(arr[i]); minList.add(arr[i+1]); } else{ maxList.add(arr[i+1]); minList.add(arr[i]); } } max = MyClass.maxValue(maxList); min = MyClass.minValue(minList); //print logic } MyClass{ int val; boolean greaterThan(MyClass a,MyClass b){ //logic to decide } }

Then we had a discussion about how to improve “bothValues” method. The approach is to get min and max for each pair and then call the maxValue , minValue methods respectively on all maxs and mins. That way we can decrease no of calls made to the greaterThan method.

**Round 3:**

After the code, he asked if it works for numbers that are not integers. Then can this be used for doing multiplication?

Type-ahead suggestion discussion for words then for sentences.

How to design Google Docs which multiple people are editing at the same time, he was looking for answers in terms of multi-threading. Few more random questions related to system design concepts

**Round 4: **This was the hiring manager round. The first 3 rounds happened on a Saturday. This round was scheduled for the following Tuesday. There were a few behavioral questions.

- What will you do if some else takes credit for your work?
- How will you convey to the team that you want to work on one particular project?

Then he asked me to decide on a simple API rate limiter. After a lot of discussion about the scope of the problem, I gave a queue-based approach and wrote a small block of code.

I was asked about my current pay and location and if I will be interested if they give an offer. Got to know that I got the offer the same day. There was a lot of delay in the further process.

But it was a good experience, Interviewers were very reasonable.