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

SDE - 2

Microsoft
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Journey
In the beginning, I started learning about basics DSA concepts. These included topics like array, string, stack, queue and solving questions on hacker rank. After practising enough on Hacker Rank, I moved to advanced DSA topics including LinkedList, Tree, Graph, DP, etc. I practiced these topics on Geeksforgeeks, leetcode, codeforces. Then I gave some mock interviews as well that helped me prepare for interviews.
Application story
This was an on-campus opportunity. The company visited our campus and we directly applied through their portal. Shortlisting was done on the basis of resumes and then further interview rounds were carried out.
Why selected/rejected for the role?
My basic concepts of all the topics were clear and I also prepared HR questions through mock interviews. I practised all the basic to medium coding question before interview.
Preparation
Duration: 2 months
Topics: OOPs, SQL, DBMS, Graph, Dynamic Programming, Array, String, System Design
Tip
Tip

Tip 1 : Practice 3 question atleast daily on any coding platform such as GFG, Leetcode, Coding NInjas
Tip 2 : Be consistent

Application process
Where: Campus
Eligibility: 7.5 CGPA
Resume Tip
Resume tip

Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 minutes
Interview date10 Feb 2021
Coding problem2

1. Number of Islands ||

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

You have a 2D grid of ‘N’ rows and ‘M’ columns which are initially filled with water. You are given ‘Q’ queries each consisting of two integers ‘X’ and ‘Y’ and in each query operation, you have to turn the water at position (‘X’, ‘Y’) into a land. You are supposed to find the number of islands in the grid after each query.

An island is a group of lands surrounded by water horizontally, vertically, or diagonally.

Problem approach

I used DFS to find number of distinct components.

Try solving now

2. Add First and Second Half

Moderate
35m average time
65% success
0/80
Asked in companies
Lenskart.comDunzoAmazon

You are given a Singly Linked List of N nodes such that each node represents a single digit.

Your task is to return a node 'X', where 'X' represents the head of the Linked List storing the digits of the sum(most significant digit at the head) formed by adding the 1st half and 2nd half of the given Linked List.

Note:

1. When N is odd consider the middle element to be part of 1st half.

2. The sum should not contain any leading zero, except the number 0 itself.
For Example:
Given Linked List: 1-2-3-4-5-5-6

First half: 1-2-3-4    
Second half: 5-5-6

Output Linked List: 1-7-9-0 = (1234 + 556 = 1790)

Follow Up:

Can you add both halves without finding the length of Linked List and in O(1) space?
Problem approach

Simple list traversal concept

Try solving now
02
Round
Medium
Face to Face
Duration70 minutes
Interview date11 Feb 2021
Coding problem3

1. Next greater element

Easy
10m average time
90% success
0/40
Asked in companies
IBMInfo Edge India (Naukri.com)Amazon

You are given an array 'a' of size 'n'.



The Next Greater Element for an element 'x' is the first element on the right side of 'x' in the array, which is greater than 'x'.


If no greater elements exist to the right of 'x', consider the next greater element as -1.


For example:
Input: 'a' = [7, 12, 1, 20]

Output: NGE = [12, 20, 20, -1]

Explanation: For the given array,

- The next greater element for 7 is 12.

- The next greater element for 12 is 20. 

- The next greater element for 1 is 20. 

- There is no greater element for 20 on the right side. So we consider NGE as -1.
Problem approach

Solved using stack

Try solving now

2. Word Break

Moderate
15m average time
85% success
0/80
Asked in companies
Morgan StanleyMakeMyTripIBM

You are given a list of “N” strings A. Your task is to check whether you can form a given target string using a combination of one or more strings of A.

Note :
You can use any string of A multiple times.
Examples :
A =[“coding”, ”ninjas”, “is”, “awesome”]  target = “codingninjas”
Ans = true as we use “coding” and “ninjas” to form “codingninjas”
Problem approach

Paraphrasing the solution in my words

Let's take an example. s="catsand" and wordDict = ["cat", "cats", "and", "sand"].

The solution starts by taking the string S( "catsand") initially finding whether whole string is present or not . IN this case it is not present in the dict.

Now breaking the string and then finding
s.substr( i) gives the substring from ith index till the end. so string word goes as

atsand // not present
tsand // not present

sand //present then the remainder is calculated which is cat in this case and recursive function is called and same thing is done with cat which will return cat and also store the result in the unordered map . Now comes the combine part where both the string are combined and the pushed in the result " cat sand".

and // then comes and which is present so now again wordbreak called on remainder which is cats now and this will return cats. Now both strings are combined and inserted into result . result = {. "cat sand", "cats and"}; Now after the loop ending the result is returned and also stored in map.

Try solving now

3. Generate all parenthesis

Moderate
30m average time
85% success
0/80
Asked in companies
AppleMicrosoftAmazon

You are given an integer 'N', your task is to generate all combinations of well-formed parenthesis having ‘N’ pairs.


A parenthesis is called well-formed if it is balanced i.e. each left parenthesis has a matching right parenthesis and the matched pairs are well nested.


For Example:

For ‘N’ = 3,
All possible combinations are: 
((()))
(()())
(())()
()(())
()()()
Problem approach

Stack concept helped me to solve this problem

Try solving now
03
Round
Easy
Face to Face
Duration60 minutes
Interview date11 Feb 2021
Coding problem1

It was mix of HLD, LLD design discussion of your project. Make sure you know enough about your projects.

1. System Design

What do you know about Microsoft leadership principles? 

Problem approach

Tip 1 : Revolve your answers around amazon leadership principles.
Tip 2 : Make sure you do have good knowledge of your projects.

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 - 2
3 rounds | 9 problems
Interviewed by Microsoft
2055 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 5 problems
Interviewed by Microsoft
1650 views
0 comments
0 upvotes
company logo
SDE - 2
5 rounds | 7 problems
Interviewed by Microsoft
1649 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 5 problems
Interviewed by Microsoft
7377 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 2
5 rounds | 12 problems
Interviewed by Walmart
29891 views
8 comments
0 upvotes
company logo
SDE - 2
3 rounds | 5 problems
Interviewed by Amazon
6765 views
1 comments
0 upvotes
company logo
SDE - 2
6 rounds | 8 problems
Interviewed by Amazon
5280 views
0 comments
0 upvotes