Microsoft Interview Experience | Set 70 (On-Campus for IDC and IT)
Microsoft recently visited campus to hire interns for IDC and IT profiles.
I’d like to share my experiences.
- Online MCQ Round – about 15 questions and 30 minutes – MCQ questions on cocubes.com
Problems were mostly output type questions in C and Java with a few questions on Combinatorics.
- Online Coding Round – Two coding questions on cocubes, one hour provided.
First question was given a binary tree, write a function that returns a linked list of the leaves of the tree such that
a) Nodes in the linked list are in the order of left-most leaf to right-most, i.e, head is the left-most leaf
b) Using constant ( O(1) ) memory – storing the pointers etc not allowed
Second question was, given an array and a window size that is sliding along the array, find the sum of the count of unique elements in each window.
For example, if the array were 1 2 1 3 3 and window size was three First window - 1 2 1 - only two unique = 1 Second window- 2 1 3 - all unique = 3 Third window - 1 3 3 - only one unique = 1 Total = 1+3+1 = 5 Which was to be returned.
Few people solved it in O(n) but most solved it in O(nk) where n is the size of the array and k is window size.
- Group Fly Round – Two problems were given, to be solved in about twenty minutes (maximum)
The problems were :
a) Given a sorted array that has been rotated, find the index upto which array is sorted.
For ex : 3 4 5 6 1 2, the answer would be 3, because index of element 6 is 3.
b) Given an array of numbers, find the largest product of three numbers in the array
We were expected to code our solution, write the approach, time complexity and test cases.
For the first problem, they expected a O(log n) solution, where n is the size of the array.
For the latter, they primarily wanted to check if the applicant accounted for negative numbers in the array and that the product could either be of three positive numbers or two negative and one positive number.
- F2F interview I – Few theory based questions like abstraction in C++, volatile keyword.
Was given a problem – “Given an array of numbers, write a function that returns a balanced binary tree” . He also asked me to modify it to return a binary tree that is as close to symmetric as possible.
- F2F interview II – Was first given a simple pattern printing problem – for example, if 16 is given, to print :
16 11 6 1 -4 1 6 11 16 if input was 10 10 5 0 5 10
The challenge was to not declare any variables or use any loops. Gave a simple recursive function that used stack implicitly to print the pattern. He was satisfied.
Second problem was, given two sorted arrays, to merge them in linear time and without using extra space, i.e, given an array with enough extra space to hold a second array and a second array, both of them sorted, to merge second into first and return it in O(m+n) time and O(1) space complexity, where m is size of first and n is size of second array.
- F2F interview III – This was partly a HR interview too, where we discussed Microsoft and its services/ work culture / competition.
The only problem was given a dictionary of all words, to print all sets of anagrams together, in time linear to the number of words in the dictionary.
The interviews were really thought provoking and the interviewers were helpful and friendly. It felt like solving problems as a team and not at all like a test. The interviewers were quite receptive to our questions and patient.
About 70 people wrote the online MCQ round and about 30 made it to coding round. Some were called for interview directly and some had to go through group fly. Most of the candidates selected were those who went through group fly.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.