Microsoft Internship Interview Experience
It was an online coding round. There were 3 coding questions to be solved in 90 minutes. The questions were:
1. There are exactly N bus stops from Tracy’s coaching center to her home. The number of buses that can be boarded from each bus stop is also given. A bus will only stop at a bus stop whose number is a multiple of the bus stop number from which the bus originates. Find the number of buses originating from each bus stop between her coaching center and her home.
2. You are distributing N candies to K children. You give 1 candy to first child, 2 to the second and so on till K children have received K candies. You then restart from the first child and give him/her K+1 candies, K+2 candies to the second one, and so on till all the candies are distributed. Find the number of candies that each child gets.
3. Given ‘n’ integers (1<=n<=1000), find the majority element i.e an integer that occurs more than half a number of times. If not, return -1.
This round was over skype. Firstly, the interviewer asked me to introduce myself, then he shared a link to collab edit. I was asked to rotate the elements of an array one by one from a given element and print the resultant array.(I told him the brute force so he asked me to optimize it) I was asked to perform dry run of the entire code. He then asked me what is try, catch, and final in OOPs. Then I was asked about my project on image processing. Later on, he asked me to write a code to find the maximum profit that you can make by buying and selling stocks, given per day cost of a stock in an array. (This round lasted for 1 hour 15 minutes)
This was the first on-campus interview at Microsoft Office in Hyderabad. Nearly, 25 students were shortlisted for this round..
Firstly I was asked to introduce myself. Then he asked me to find the minimum element in a stack. Next question was to determine whether a tree is a Binary Search Tree or not.
Then he asked me to search an element in a sorted array whose rows as well as columns are sorted. Then I was asked to fill the elements in a 2×2 matrix sudoku in which some elements were already inserted.
Later on, he gave me a proper 9×9 sudoku and asked me to give an approach to insert elements in O(N) time complexity. ( I kind of blanked out so I asked him for a hint so he suggested that I should try backtracking.
Then I could think of an approach) Then I was asked what is system design followed by differentiating between paging and segmentation, internal and external fragmentation. Is paging disadvantageous, if so kindly explain?
Then I was asked two puzzles. You are given 8 balls out of which one is heaviest and the rest are equi-weighted. You have two weighing machines. Find the minimum number of attempts required to determine the heaviest ball.
The next question was, there is a king having 1000 glass bottles. One day, a person poisons one of the bottles. The king has an unlimited number of prisoners. Find the minimum number of prisoners required to determine the poisoned bottle within the time period of a month. (This round lasted for one and a half hour).
The interviewer was pretty cool. After the introduction, I was asked questions like where are you from?
What is special about you? Why should we select you?
Which was your favorite subject in last semester?
Why do you want to join Microsoft?
What Microsoft technologies have you used to date? Then he asked me to elaborate on any of my projects and what I learned from it followed by questions like what do I expect from this internship?
What do you want to do in future?
I was asked to wait outside for the result. (This round was pretty short as compared to the first one) (Out of 25 students, 10 were shortlisted for the internship and I consider myself very lucky to be one of them)
[Tips: Just stay calm and confident. Answer all the questions confidently and clear any doubts before solving the question. The interviewer is always ready to help, you just need to analyze what approach is he expecting. ]