Microsoft Interview Experience SDE 1 off campus (8 months exp)
1st round was skype interview:
Question 1 : Given a bst find 4 numbers which sum upto a given number .
without using extra space
Answer: Convert bst to dll and use 2 pointers approach O(n^3)
Question 2 : It was based on BST also, don’t remeber the question.
From 2nd round onwards it was on Microsoft Hyderabad campus:
Question 1: Given a rowwise and column wise sorted matrix find number of negative elements in it.
Expected time complexcity O(n).
Answer: Start from bottom left element and if element is negative move right and if positive move up counting the number of negattive elements in a row and keeping boundary condition in mind.
Question 2: Given a Array of String encode that array into a String such that decode function can decode using the encoded String only.
Answer : For each String add Length of string a delimiter and String to encoded String.
If String is “abcd”
add 4#abcd to encoded String
Question 1 : Given a binary tree and a list of nodes to be deleted, find the root node of each tree after deletion
For ex if tree is
and node to be deleted is 2, then answer will contain 1, 4, 5
O(n) single traversal.
Answer using postorder traversal.
Question 2: Given Dictionary of words and mobile Keypad, given number find all dictionary String starting from it.
https://www.geeksforgeeks.org/find-possible-words-phone-digits/ similar to this
Based on transforming 1 String to another, using graphs.
Round 3 : Manegerial Round:
General HR questions:
Why should we hire you?
Why do you want to change?
What do you do apart from projects?
One Technical Question:
Sort 50 GB large file of words.
Sorted chunks and then used heap.
Then told about the team i will be joining in details.
In every question they wanted Production ready code on paper.