Microsoft Interview Experience (On-Campus for Internship 2018)
Online Coding Round :
- This round was conducted on Cocubes. There were 3 coding questions for which time alloted was 75 minutes. There were various sets of questions .My questions were:
- Given a string, the task is to find the average of ASCII values of characters in the string .
- Intfix evaluation.
- Cousin sum of a binary tree .
- Next smallest palindrome.
- Given a number in form of string containing n digits .Find the smallest string after m deletions.
- Reverse a Linked List in groups of given size
Other questions were:
- This round was a pen paper round .Questions included 7 short answer question based on C and data structures and a coding question was there .All short questions were mandatory.
Short questions were easy just read the question carefully 🙂 because chances of silly mistake were there .
Interview I :
- In this round questions asked with me were:
- Implement three stacks in an array such that space is well utilized.
- I was given a min heap and was asked to code for converting it to max heap .(I had to write a clean a code and dry run it on a given array representation of heap);
- I was given a 2’s complementary binary representation of a number and I had to convert it into decimal.
After that normal questions on data structures were asked like amortized time to built a heap and to proof it .
This was the round I liked the most so I want to elaborate it .In this round interviewer asked me about what questions were asked in previous interviews, my favourite data structure for which I replied trees and then why I like trees etc.Basic questions on trees.
At first I started with a brute force solution just searching the pattern starting with every index position.I was asked to write the code for this. Further I suggested KMP algorithm search .But the interviewer wanted something out of my mind not an already present algorithm or such and asked me also if I can optimize it further .After sometime I came up with building a suffix tree thus the search time was just reduced to length of the string but the space complexity was huge in worst case and after every insertion or deletion I had to build the whole tree again.The interviewer was impressed with this but asked me to optimize it further . Later I thought to implement it with a structure containing a set for each character and store the index of occurence of each character in this set and suggested to run dfs for searching the pattern (Thus the space complexity was reduced to O(n) ).The interviewer was impressed with the approaches I tried .Later he asked me have I any question for him.
TIPS : Always discuss the first solution which come in your mind whatever be the complexity then proceed to think for the optimized one.
This was the last round . I was asked to introduce myself .Then what are my interests and what do I want to see myself in coming future, my achievements etc.
One of the question was finding a number in sorted and rotated array.
Later he asked me have I any question for him.
6 students got internship and I was one of those.
TIPS :Remain honest through out the interview .Inteviewers just want to see how you approach to an unknown problem so dont think that complexity of my solution is too much .Discuss with the Interviewers whatever you are thinking . Some students were asked puzzles also (You can find sample ones at geeksforgeeks puzzles section).
THANKS FOR READING .