Microsoft interview experience Real time questions & tips from candidates to crack your interview

SDE - Intern

Microsoft
upvote
share-icon
3 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: Data Structures, Algorithms, C++, Operating Systems, DBMS, OOPS.
Tip
Tip

Tip 1 : Practice DSA questions regularly from coding platforms.
Tip 2 : Have a clear understanding of the OS, DBMS and OOPS concepts. 
Tip 3 : Be proficient in one programming language.

Application process
Where: Campus
Eligibility: Above 8 CGPA
Resume Tip
Resume tip

Tip 1 : Resume should be of 1-page only.
Tip 2 : Focus more on sections like Work Experience, Projects etc.

Interview rounds

01
Round
Medium
Video Call
Duration60 minutes
Interview date10 Aug 2020
Coding problem2

This was the first round. The interviewer discussed two coding problems with me.

1. LCA of Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
GrabDisney + HotstarShareChat

You have been given a Binary Tree of distinct integers and two nodes ‘X’ and ‘Y’. You are supposed to return the LCA (Lowest Common Ancestor) of ‘X’ and ‘Y’.


The LCA of ‘X’ and ‘Y’ in the binary tree is the shared ancestor of ‘X’ and ‘Y’ that is located farthest from the root.


Note :
You may assume that given ‘X’ and ‘Y’ definitely exist in the given binary tree.
For example :
For the given binary tree

Example

LCA of ‘X’ and ‘Y’ is highlighted in yellow colour.
Problem approach

I explained the recursive approach of traversing the tree in a depth-first manner to him. The moment you encounter either of the nodes node1 or node2, return the node. The least common ancestor would then be the node for which both the subtree recursions return a non-NULL node. It can also be the node which itself is one of node1 or node2 and for which one of the subtree recursions returns that particular node.
Pseudo code :
LowestCommonAncestor(root, node1, node2) {
if(not root)
return NULL
if (root == node1 or root == node2) 
return root
left = LowestCommonAncestor(root.left, node1, node2)
right = LowestCommonAncestor(root.right, node1, node2)
if(not left)
return right
else if(not right)
return left
else
return root
}

Try solving now

2. Median of two sorted arrays

Hard
25m average time
65% success
0/120
Asked in companies
GrabMicrosoftWells Fargo

Given two sorted arrays 'a' and 'b' of size 'n' and 'm' respectively.


Find the median of the two sorted arrays.


Median is defined as the middle value of a sorted list of numbers. In case the length of list is even, median is the average of the two middle elements.


The expected time complexity is O(min(logn, logm)), where 'n' and 'm' are the sizes of arrays 'a' and 'b', respectively, and the expected space complexity is O(1).


Example:
Input: 'a' = [2, 4, 6] and 'b' = [1, 3, 5]

Output: 3.5

Explanation: The array after merging 'a' and 'b' will be { 1, 2, 3, 4, 5, 6 }. Here two medians are 3 and 4. So the median will be the average of 3 and 4, which is 3.5.
Problem approach

1. I explained the linear approach to him first - Merging the sorted arrays and then finding the median element.
Time Complexity : O(m + n)
2. Later, I explained the binary search approach to him. He asked me to code it and do a dry run on one example.

Try solving now
02
Round
Easy
Video Call
Duration45 minutes
Interview date10 Aug 2020
Coding problem1

This was the second round. We started with a brief introduction. The interviewer then asked one coding problem and we had a long discussion on that problem only.

1. Possible Words From A Phone Number

Hard
55m average time
45% success
0/120
Asked in companies
Expedia GroupAmazonMicrosoft

After years of research, Ninja is finally able to invent the time machine, and now he is back to the good old days when T9 keypads were being used in mobile phones.

Being a curious person, Ninja wants to find out all possible strings that can be formed by pressing the keys of the phone.

Formally, you are given a string S, that consists of digits from 2-9 (both inclusive), your task is to find out all the possible strings that can be formed from the input string by mapping the digits to the letters as in a T9 keypad. Then, print the strings in a lexicographically sorted order.

T9_Keypad

For Example:
If S = “34”, then all the possible letters that can be formed from string S are {“dg”, “dh”, “di”, “eg”, “eh”, “ei”, “fg”, “fh”, “fi”}.
Problem approach

Map the number with its string of probable alphabets, i.e 2 with “abc”, 3 with “def” etc.
Create a recursive function which takes the following parameters, output string, number array, current index, and length of number array
If the current index is equal to the length of the number array then print the output string.
Extract the string at digit[current_index] from the Map, where the digit is the input number array.
Run a loop to traverse the string from start to end
For every index again call the recursive function with the output string concatenated with the ith character of the string and the current_index + 1.

Try solving now
03
Round
Easy
Video Call
Duration40 minutes
Interview date10 Aug 2020
Coding problem1

This was a typical managerial round. We started with a brief introduction. Then, the interviewer moved to my projects and started asking questions on one of the projects that he found interesting. At last, he asked me some questions based on Operating Systems.

1. Operating System Questions

1. Difference between process and thread. Give example.
2. Difference between Internal and External Paging
3. What is virtual memory?

Problem approach

Tip 1 : Revise all OS concepts from Galvin.
Tip 2 : Have a clear understanding of the concepts as real-life based examples can also be asked.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 8 problems
Interviewed by Microsoft
2318 views
2 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
1353 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 5 problems
Interviewed by Microsoft
1985 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Microsoft
632 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15605 views
4 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10216 views
2 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by Amazon
6389 views
3 comments
0 upvotes