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

SDE - 1

Microsoft
upvote
share-icon
4 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 months
Topics: C++, Data Structures, Dynamic Programming, Algorithms, Operating Systems, Object Oriented Programming, Database Management System
Tip
Tip

Tip 1: Having a grip over Data Structures and Algorithms is very important. Have your concepts crystal clear, and then pick one coding platform and try to practice around 7-10 questions every day with varying difficulty and different topics. 
Tip 2: After writing code for a particular question, try to analyze its time and space complexity. Think about how you can optimize your code further. Also, refer to the editorials and compare your solution with it. Interviewers ask a lot about further code optimization. Hence, instead of trying to solve more and more problems, try to analyze a question completely and understand the concept behind it. 
Tip 3: Along with coding, study about OOPS. Coding Ninja's Data Structures and Algorithms course helped a lot in preparing the OOPS concepts. Also, OS and DBMS must also be studied. You can refer to CodeStudio for these topics.
Tip 4: Keep participating in coding contests. It helps you increase your speed. 

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

Tip 1 : Do not fake any skills, projects or achievements. The interviewer gets to know about it by asking questions to you.
Tip 2 : You do need to have a long list of projects. Any 1 good project with proper knowledge of it will also do good. Similarly, you do need to have many skills to be listed down. Few skills but with proper knowledge is great.
Tip 3 : Try to write achievements which proves your technical skills, communication skills, leadership quality or teamwork.

Interview rounds

01
Round
Easy
Online Coding Test
Duration90 minutes
Interview date6 Aug 2020
Coding problem3

This round consists of 3 coding questions with a total time limit of 90 minutes. The first two questions were of easy level and the third question was of medium level. No two candidates had the same set of questions, the distribution of questions was random. The test was conducted on mettl platform with both audio and video on for monitoring on the candidate.

1. Running median

Hard
46m average time
50% success
0/120
Asked in companies
OYOHikeSprinklr

You are given a stream of 'N' integers. For every 'i-th' integer added to the running list of integers, print the resulting median.

Problem approach

Since the array was unsorted, fist sort the array.
Return the middle element of the array if n is odd else return the average of middle two elements.

Try solving now

2. Fruits and Baskets

Easy
10m average time
90% success
0/40
Asked in companies
MicrosoftAmazonQuantiphi

There are ‘n’ fruit trees that are planted along a road. The trees are numbered from 0 to n-1. The type of fruit each tree bears is represented by an integer from 1 to 'n'.


A Ninja is walking along that road. He has two baskets and wants to put the maximum number of fruits in them. The restriction is that each basket can have only one type of fruit.


Ninja can start with any tree and end at any tree, but once he has started, he cannot skip a tree i.e if he picks fruit from the tree ‘i’, then he has to pick fruit from tree ‘i+1’ before going to the tree ‘i+2’. He will pick one fruit from each tree until he cannot, i.e, he will stop when he has to pick a fruit of the third type because only two different fruits can fill both baskets.


You are given an array ‘arr’. The ‘i’th integer in this array represents the type of fruit tree ‘i’ bears. Return the maximum number of fruits Ninja can put in both baskets after satisfying all the conditions.


For Example:
 'arr' = [1, 2, 3]

 Here, we have three different types of fruits. We can pick [1, 2] or [2, 3]. We can pick a maximum of two fruits.

Hence, we return 2.
Problem approach

1. Add all the number of fruits.
2. Divided the total number of fruits with number of baskets, lets say this x.
3. Subtract x from all the initial number of fruits from each basket.
4. Add all the numbers and that is the final answer.

Try solving now

3. Dice Throws

Hard
35m average time
65% success
0/120
Asked in companies
MicrosoftDisney + HotstarShareChat

You are given D dice, each having F faces numbered 1 to F, both inclusive. The task is to find the possible number of ways to roll the dice together such that the sum of face-up numbers equal the given target S.

Note :
As the answer can be large, return your answer modulo 10^9  + 7.
Follow Up :
Can you solve this using not more than O(S) extra space?
Problem approach

First I thought of the Naive approach which is to find all the possible combinations of values from n dice and keep on counting the results that sum to X. But since it consisted of some overlapping subproblems, I came to the conclusion that it can be solved by DP as well. Create a 2D array with the number of throws as row index and the sum as column index. Return the last element of 2D array.

Try solving now
02
Round
Medium
Video Call
Duration50 miutes
Interview date10 Dec 2020
Coding problem2

This was my first interview and I was a bit nervous. The interview was conducted on Microsoft Team. He told me to share my screen and write the pseudo code on notepad. The interviewer was very friendly and also gave me hints for the question. However, he mostly focused on optimization of the code. At the end of the question, few questions related to Operating Systems were asked.

1. Group Anagrams

Moderate
30m average time
70% success
0/80
Asked in companies
AmazonAtlassianThales

You have been given an array/list of strings 'inputStr'. You are supposed to return the strings as groups of anagrams such that strings belonging to a particular group are anagrams of one another.

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase. We can generalize this in string processing by saying that an anagram of a string is another string with the same quantity of each character in it, in any order.

Note:
The order in which the groups and members of the groups are printed does not matter.
For example:
inputStr = {"eat","tea","tan","ate","nat","bat"}
Here {“tea”, “ate”,” eat”} and {“nat”, “tan”} are grouped as anagrams. Since there is no such string in “inputStr” which can be an anagram of “bat”, thus, “bat” will be the only member in its group.
Problem approach

I applied Sliding Window technique to it.
The time complexity was O(N).
1. Store the frequency of characters in string p in a vector.
2. Run a sliding window as follows:
If the current count of the new character s[r] in the window is less than that in p, increment count.
If the length of the window equals p, compare count with p.length(). If they are same, add l to the result.
Also, remove the character at the begining s[l] from the current window. If the new count of character s[l] becomes smaller than that in p, decrement count.

Try solving now

2. Operating System

1. When does deadlock occur?(Learn)
2. What is the difference between process and threads?(Learn)

Problem approach

Tip 1 : Always give a structured answer. For example, first tell the definition and then quotes a few examples in support of it.
Tip 2 : Do refer to CodeStudio for OS. Try to read as many articles as you can.

03
Round
Medium
Video Call
Duration45 minutes
Interview date10 Dec 2020
Coding problem2

The second round consisted questions related to concepts of object oriented programming and databases. At the end of the interview he asked me to explain any one good project. The interview lasted for 45 minutes. The interviewer was friendly and good.

1. OOPS Questions

1.What is the difference between static polymorphism and runtime polymorphism?(Learn)
2. What is a copy constructor? Tell any one use of it.(Learn)
3. Define Encapsulation.(Learn)

Problem approach

Tip 1 : Always think properly before saying your answer. Try to communicate clearly.
Tip 2 : Coding Ninja's Data structures and algorithms in C++ course helped me a lot in clearing my OOPS concepts.
Tip 3 : Along with definitions, try to give examples also.

2. Merge Sort

Easy
15m average time
85% success
0/40
Asked in companies
BarclaysOracleHCL Technologies

Given a sequence of numbers ‘ARR’. Your task is to return a sorted sequence of ‘ARR’ in non-descending order with help of the merge sort algorithm.

Example :

Merge Sort Algorithm -

Merge sort is a Divide and Conquer based Algorithm. It divides the input array into two-parts, until the size of the input array is not ‘1’. In the return part, it will merge two sorted arrays a return a whole merged sorted array.

subsequence

The above illustrates shows how merge sort works.
Note :
It is compulsory to use the ‘Merge Sort’ algorithm.
Problem approach

1. You should know properly about what is merge sort.
2. The pseudo code is as follows:
MergeSort(arr, left, right):
if left > right
return
mid = (left+right)/2
mergeSort(arr, left, mid)
mergeSort(arr, mid+1, right)
merge(arr, left, mid, right)
end

Try solving now
04
Round
Easy
HR Round
Duration30 minutes
Interview date10 Aug 2020
Coding problem1

This was my last round and I was a bit tensed. It was an HR round. The interviewer was very professional. He discussed and asked questions about my various achievements, my interests apart from the technical field and also asked about my projects. I made sure to answer all the questions confidently and calmly.

1. General Questions

1. Tell me about yourself.

2. Which is your favorite project? Elaborate that project.

3.  Asked a question related to one of my achievements.

4. What role do you want in Microsoft?

5. Is there any technology that interests you and you would like to work upon?

Problem approach

Tip 1 : While answering to the question "tell me about yourself" , you can mention your technical skills and how you developed interest in coding. Apart from technical side, you can also tell your other areas of interest and hobbies.
Tip 2 : You should be clear about all the projects, the technologies used in it, why you used them specifically, the purpose of the project, etc. 
Tip 3 : Don't try to fake any achievements. The interviewer can ask tricky questions and it can become difficult to handle if you haven't achieved it.
Tip 4 : For the question - What role do you want in Microsoft?, I answered that I just need a role where I can share my ideas with the team, help the company to grow and build a product which is useful for the society.
Tip 5 : You should be also be a bit aware about the company. Spend around 1 hour before the day of the interview and do a proper research about the company and its principles.

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 - 1
5 rounds | 15 problems
Interviewed by Microsoft
4035 views
0 comments
0 upvotes
company logo
SDE - 1
5 rounds | 7 problems
Interviewed by Microsoft
2661 views
0 comments
0 upvotes
company logo
SDE - 1
1 rounds | 2 problems
Interviewed by Microsoft
7425 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 7 problems
Interviewed by Microsoft
1272 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
115097 views
24 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35147 views
7 comments
0 upvotes
company logo
SDE - 1
3 rounds | 11 problems
Interviewed by Amazon
21829 views
4 comments
0 upvotes