Microsoft Interview Experience for Software Engineer | On-Campus 2019
It was an on-campus recruitment.
There were five rounds
Round 1: Online Assesment on 5/11/19
There were three coding questions.
- Its was a question where ships are sailing in layers.
- Each ships has a value n.
- Each ship is followed by (n * n + 1) % M distinct ships whose value is 0 to (n * n + 1) % M – 1
- Inputs given was L no. of layer and M
Find the total number of ships in all the layers modulo M.
- Need to return the maximum distance between any two coordinates from given n coordinates. use Euclidean’s method to calculate distances
- Minimum swaps to make a string palindrome
I could solve all three questions.
Round 2: Group Fly on 30/11/19
In this round, 6-8 students were assigned to a panel member, and we were given two questions. We need to discuss our approach and then write the code on paper.
- Find the leftmost right cousin of a given binary tree
A / \ B C / \ / \ D E F G
So the left most right cousin of D is F, E is F, F is NULL, G is NULL
- Given a list of words return those words which contain other words as its prefix.
Eg: [“a”, “after”, “afterwords”, “b”, “be”, “before”]
Output: [“afterwords”, “before”]
I could solve both the code and wrote it on paper cleanly with proper comments.
Next three rounds of F2F interview happened on 1/12/19
Total 3 round took 2.5 hrs
Round 3: F2F interview
The interviewer was excellent, helped me to calm down. Then asked me the intersection of two link list question. I explained two approaches and then wrote the code on paper.
Round 4: F2F interview
The interviewer asked me two questions:
- Snake and ladder
- Given a list of edges E and list of vertex pairs V. Check if we can create a graph using edges in E such that no pair of vertices in V are connected. Consider both direct and indirect connection.
I gave two-three approaches for both questions. The interviewer asked me to write code of 2nd question, when I wrote half of the code, he said time is up.
Round 3: F2F interview
Asked me one question: merge two sorted lists
There can be a duplicate, but the final list should be distinct. i.e. each duplicate should be taken once.
The interviewer asked me to provide at least three approaches. Asked me to write code for the two approaches out of three I could answer. I gave a recursive approach, an approach where we take e extra head pointer and another approach where I was inserting the node of the 1st link list in 2nd one — coded 1st two approach.
After waiting for 5 min, the HR informed me that they are giving me the offer.