Recently , Microsoft visited our campus for recruiting FTE for MS-IDC division.
Around 150 students appeared for the test.
Round 1(75 minutes):
Online coding round hosted on HackerRank . Three coding questions were asked.
- Given a Linked List of integers, write a function to modify the linked list in-place such that all odd numbers appear before all the even numbers in the modified linked list. The relative order of even and odd numbers should remain the same.
Solution: Segregate Even Odd nodes in a Linked List
- Given a floating point number, calculate its square root without using in-built sqrt() function.
- Given a pattern string and a test string, implement RegEx substring matching. If the pattern is preceded by a ^, it will match with the starting position. Similarly, if it is preceded by a $, it will match the ending position. If no such markers are present, it will check whether pattern is a substring of test.
Ex : ^coal
Result : True
Result : True
Result : False
25 students were selected for the next round.
Round 2(paper coding round):
- Print boundary traversal of Binary tree in clockwise direction.(Note: check for leaf nodes in left and right traversal for a given tree).
- Rotate a square image 90 degree clockwise. Optimize as much as u can.
8 students were selected for further rounds.
Round 3 – PI1
- Discussed about the 1st question asked in paper coding round, i.e., Boundary traversal of Binary tree.
- How to merge two BSTs . Asked me all the approaches that I was able to implement . Then asked me to do in O(logn), where n is total no. of nodes .
- Asked me to write code to find a no. occurring greater than n/2 times in an array . Then asked me to prove the written algorithm , basically , he was asking how I was able to write that code and why is it working .
7 students were selected for further rounds.
- Asked me to implement seat booking process in BOOKMYSHOW.com . How to handle the cases where two persons are trying to access the same seat at almost same time . He told me to write class based solution asking about different functions that should be used to solve all the cases for booking procedure .
- What is singleton class?
- How to find the point of intersection of two line segments . Two end points of line segments were given.
- How to find no. of 2’s between nos. 1 to n . He gave me few hints and finally , he was satisfied with my approach .
- he asked me to implement fibonacci series considering every possible solution .
And few more questions were asked , but I don’t remember them.
6 students were selected for further rounds
- Write function for inorder traversal of Binary tree without recursion. That was easy !!
- Asked me a puzzle question. An n*n board is given and one of the given cells is black . Also , L shaped pieces are given (equivalent to 3 cells of given matrix) , considering all possible rotations. I had to fill the entire grid using those pieces . Pieces can’t be placed on the black cell and no two pieces should overlap , not even partially . I gave an answer where I tried to increase the size of unaccesible cells( black cells and already placed pieces on board) to the size of the given board , but he asked me few cases where my answer failed. Then I said him we can do the exhaustive search of combinations using backtracking but it will take too much time . Then he gave me clue that instead of growing the size of unaccesible cells, try to decrease it. Finally , I concluded that it divide-n-conquer based solution considering base case as 2*2 board with 1 black cell.
4 students were selected for further rounds.
Round 6 : PI4
- he told me to implement LRU Cache . I gave him all the solutions that can be possible . He was very helpful . He found flaws and told me to optimize it. I gave him 3 solutions and the final one is the one which you can find anywhere on the internet. But before that , he asked me to swap two nodes of a DLL using hashmap . I didn’t know what Lru Cache is initially . haha
Round 7 : PI5 and final round
- What’s your passion ? What you want to do in your life ? Hr-type question .
- He designed a new language with the words of English and stored them in an array of strings . Then he gave me two strings and told me to design strcmp function . I told him the best method in one go , but he tried to confuse me and he was successful . He gave me 5 mins to come up with another solution and tried new one . Lastly , I implemented the first approach I had in mind and he was satisfied with it.
- How to serialize and deserialize an n-ary tree . I told him the function for serializing and deserializing a binary tree but couldn’t come up with solution for the given problem.
P.S : I was not comfortable with OS and DBMS , so I told them clearly but they tried to ask indirectly all the basic questions of OS and DBMS , and told me to implement them using C/C++.
Questions asked to my friends :
- Developing an algorithm for crossing bridges problem , where no. of elements is n.
- Intersection of two linked lists.
- Find if loop is present in linked list and also , find the start node of the loop in it .
- Class design for banking system.
- Reverse linked list using both recursion and iteration .
And many more.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
- Microsoft Interview Experience | Set 62 (On-Campus for IDC)
- Microsoft Interview Experience | Set 61 (On-Campus for IDC)
- Microsoft Interview Experience | Set 65 (On-Campus for Internship IT and IDC)
- Microsoft IDC Interview Experience | Set 66 (On-Campus for Internship)
- Microsoft IDC Interview Experience | Set 67 (On-Campus for Internship)
- Microsoft Interview Experience | Set 70 (On-Campus for IDC and IT)
- Microsoft IDC Interview Experience | Set 82 (On-Campus)
- Microsoft IDC Interview Experience | Set 83 (On-Campus)
- Microsoft Interview experience | Set 95 (On-Campus for IDC)
- Microsoft Interview experience | Set 96 (On-Campus Internship for IDC)
- Microsoft Interview experience | Set 98 (On Campus for IDC)
- Microsoft Interview experience | Set 99 (On Campus for IDC and IT)
- Microsoft Interview experience | Set 100 (On Campus for Internship on IDC and IT)
- Microsoft Interview experience | Set 102 (On Campus for IDC)
- Microsoft Interview experience | Set 103 (On Campus for IDC)
- Microsoft Interview experience | Set 104 (On Campus for IDC)
- Microsoft Interview Experience | Set 141 (Off-Campus - Online Coding Test for IDC)
- Microsoft Interview Experience | Set 148 (Internship IDC Pool Campus)
- Microsoft Interview experience | Set 118 (On-Campus for IDC)
- Microsoft Interview Experience | Set 124 (On Campus for IDC)