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

Software Engineer

Microsoft
upvote
share-icon
5 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Data Structures, OOPs, System Design, Algorithms, DBMS, OS
Tip
Tip

Tip 1 : It's not about how many questions you practice, it's about how many types of questions you can solve. Example do the top questions for Amazon/Microsoft which you can find on leetcode.
Tip 2 : Try to relate everything you do to real life scenarios as software engineering is implementing those real life problems as a software/solution
Tip 3 : Have deep understanding of Computer Engineering fundamentals like OS and DBMS. This will help you in any technical interviews

Application process
Where: Referral
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1 : Express only the relevant information to your job in the resume
Tip 2 : The experiences/projects that you write should be explanatory without writing too much of it.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration70 mins
Interview date14 Dec 2021
Coding problem2

There were 3 questions. Difficulty level was easy to medium.
You will get 2-3 days to complete the assessment which can be given at any time according to you.

1. Rock Paper Scissor

Easy
15m average time
70% success
0/40
Asked in companies
MicrosoftGoldman Sachs

The winner of a game is decided in the following way:

‘Rock’ beats ‘Scissor’.

‘Scissor’ beats ‘Paper’.

‘Paper’ beats ‘Rock’.

If both players make the same move like ‘Rock’ is made by both person then that result in a draw and whose point will not be rewarded to anyone.

Now you have been provided with two strings representing the moves that they will make for ‘NEZUKO’ represents Nezuko’s string and ‘ZENITSU’ represents Zenitsu’s moves.

In the string ‘R’ represents ‘ROCK’ and ‘P’ represents ‘PAPER’ and ‘S’ represents ‘SCISSORS’.

There is a total of ‘K’ games that will be played and the player will play the move by traversing the string provided. If a player reaches the end of the string then his next moves will be played from the start of the string.

You have to tell the number of games won by Nezuko and the number of games won by Zenitsu respectively in order.

Example:
Input: ‘K’ = 3, ‘NEZUKO’ = ‘RP’, ‘ZENITSU’ = ‘R’
Output: 1 0
Game 1: ‘NEZUKO’ = ‘R’, ‘ZENITSU’ =  ‘R’, Result = ‘Draw’.
Game 2: ‘NEZUKO’ = ‘P’, ‘ZENITSU’ = ‘R’, Result = ‘Nezuko won the game’.
Game 3: ‘NEZUKO’ = ‘R’, ‘ZENITSU’ =  ‘R’, Result = ‘Draw’.
Problem approach

Approach: Let length of string a be n and length of string b be m. The observation here is that the games would repeat after n * m moves. So, we can simulate the process for n * m games and then count the number of times it gets repeated. For the remaining games, we can again simulate the process since it would be now smaller than n * m. For example, in the first example above, n = 2 and m = 1. So, the games will repeat after every n * m = 2 * 1 = 2 moves i.e. (Player2, Draw), (Player2, Draw), ….., (Player2, Draw).

Try solving now

2. Construct The String

Moderate
25m average time
70% success
0/80
Asked in companies
BNY MellonMicrosoftUber

Your friend gave you a challenge. He gave you a string ‘S’ of length ‘N’ consisting only of lowercase English alphabets. He asked you to construct the given string using the minimum number of operations. In each operation, you can do one of the steps.

1) Add a lowercase English alphabet at the end of the string.
2) Create a copy of the string and concatenate both of the strings.

Initially, you have an empty string. So if you perform the second operation, you will get an empty string.

For example: If the current string is “abc”, then after performing the second operation, the current string will be “abcabc”.

Problem approach

Approach: If the length of the string is less than 26 then print -1. The Task is to make a sub-string of length 26 that has all the lowercase characters. Thus, the simplest way is to iterate through all sub-strings of length 26 then for each sub-string count the number of occurrences of each alphabet, ignoring the question marks. After that, if there exists a character that occurs twice or more then this sub-string cannot contain all letters of the alphabet, and we process the next sub-string. Otherwise, we can fill in the question marks with the letters that have not appeared in the sub-string and obtain a sub-string of length 26 which contains all letters of the alphabet.

Try solving now
02
Round
Medium
Video Call
Duration60 mins
Interview date23 Dec 2021
Coding problem2

Two questions from LinkedList and Arrays were there in this round. Difficulty level - Medium

1. Delete Kth node From End

Moderate
15m average time
95% success
0/80
Asked in companies
Expedia GroupSquadstackAmazon

You have been given a singly Linked List of 'N' nodes with integer data and an integer 'K'.


Your task is to remove the 'K'th node from the end of the given Linked List and return the head of the modified linked list.


Example:
Input : 1 -> 2 -> 3 -> 4 -> 'NULL'  and  'K' = 2
Output: 1 -> 2 -> 4 -> 'NULL'
Explanation:
After removing the second node from the end, the linked list become 1 -> 2 -> 4 -> 'NULL'.

altImage


Problem approach

https://leetcode.com/problems/remove-nth-node-from-end-of-list/

Try solving now

2. Trapping Rain Water

Moderate
15m average time
80% success
0/80
Asked in companies
HCL TechnologiesCiti BankAtlassian

You have been given a long type array/list 'arr’ of size 'n’.


It represents an elevation map wherein 'arr[i]’ denotes the elevation of the 'ith' bar.



Note :
The width of each bar is the same and is equal to 1.
Example:
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].

Output: 10

Explanation: Refer to the image for better comprehension:

Alt Text

Note :
You don't need to print anything. It has already been taken care of. Just implement the given function.
Problem approach

https://www.geeksforgeeks.org/trapping-rain-water/

Try solving now
03
Round
Medium
Video Call
Duration60 mins
Interview date23 Dec 2021
Coding problem2

Two DS questions again in this round. One from Trees and one from tries. Difficulty level - medium

1. Bottom View Of Binary Tree

Moderate
10m average time
90% success
0/80
Asked in companies
OYOMicrosoftAmazon

You are given a 'Binary Tree'.


Return the bottom view of the binary tree.


Note :
1. A node will be in the bottom-view if it is the bottom-most node at its horizontal distance from the root. 

2. The horizontal distance of the root from itself is 0. The horizontal distance of the right child of the root node is 1 and the horizontal distance of the left child of the root node is -1. 

3. The horizontal distance of node 'n' from root = horizontal distance of its parent from root + 1, if node 'n' is the right child of its parent.

4. The horizontal distance of node 'n' from root = horizontal distance of its parent from the root - 1, if node 'n' is the left child of its parent.

5. If more than one node is at the same horizontal distance and is the bottom-most node for that horizontal distance, including the one which is more towards the right.


Example:
Input: Consider the given Binary Tree:

alt text

Output: 4 2 6 3 7

Explanation:
Below is the bottom view of the binary tree.

alt text

1 is the root node, so its horizontal distance = 0.
Since 2 lies to the left of 0, its horizontal distance = 0-1= -1
3 lies to the right of 0, its horizontal distance = 0+1 = 1
Similarly, horizontal distance of 4 = Horizontal distance of 2 - 1= -1-1=-2
Horizontal distance of 5 = Horizontal distance of 2 + 1=  -1+1 = 0
Horizontal distance of 6 = 1-1 =0
Horizontal distance of 7 = 1+1 = 2

The bottom-most node at a horizontal distance of -2 is 4.
The bottom-most node at a horizontal distance of -1 is 2.
The bottom-most node at a horizontal distance of 0 is 5 and 6. However, 6 is more towards the right, so 6 is included.
The bottom-most node at a horizontal distance of 1 is 3.
The bottom-most node at a horizontal distance of 2 is 7.

Hence, the bottom view would be 4 2 6 3 7


Try solving now

2. Word Ladder

Hard
10m average time
90% success
0/120
Asked in companies
OlaSalesforceDisney + Hotstar

You are given two strings BEGIN and END and an array of strings DICT. Your task is to find the length of the shortest transformation sequence from BEGIN to END such that in every transformation you can change exactly one alphabet and the word formed after each transformation must exist in DICT.

Note:

1. If there is no possible path to change BEGIN to END then just return -1.
2. All the words have the same length and contain only lowercase english alphabets.
3. The beginning word i.e. BEGIN will always be different from the end word i.e. END (BEGIN != END).
Try solving now
04
Round
Hard
Video Call
Duration60 mins
Interview date23 Dec 2021
Coding problem1

This round was a mix of Data Structures, System Design and problem solving. The interview started with one DS question and then I was asked a question to design a system which used the logic solved by me in the DS question. I was drilled down with the basics and in depth working of Data Structures and also some of the theories from Software Development (MVC model, etc.) and also I was asked to design the system for the same so I formulated an approach using JAVA, RDBMS, kafka as my main components in the solution.

1. Rotting Oranges

Moderate
20m average time
78% success
0/80
Asked in companies
Samsung R&D InstituteSalesforceSamsung

You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:

  • Value 0 - representing an empty cell.
  • Value 1 - representing a fresh orange.
  • Value 2 - representing a rotten orange.
  • Every second, any fresh orange that is adjacent(4-directionally) to a rotten orange becomes rotten.

    Your task is to find out the minimum time after which no cell has a fresh orange. If it's impossible to rot all the fresh oranges then print -1.

    Note:
    1. The grid has 0-based indexing.
    2. A rotten orange can affect the adjacent oranges 4 directionally i.e. Up, Down, Left, Right.
    
    Try solving now
    05
    Round
    Medium
    Video Call
    Duration45 mins
    Interview date29 Dec 2021
    Coding problem1

    This round was taken by the Manager and there was a discussion about few of my coding problems I solved in the previous rounds, a little bit of system design, my work in the current company and a few behavioral questions.

    1. System Design question

    Design Netflix.

    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
    Software Engineer
    5 rounds | 5 problems
    Interviewed by Microsoft
    10148 views
    1 comments
    0 upvotes
    company logo
    Software Engineer
    3 rounds | 2 problems
    Interviewed by Microsoft
    2134 views
    0 comments
    0 upvotes
    company logo
    Software Engineer
    4 rounds | 6 problems
    Interviewed by Microsoft
    1693 views
    0 comments
    0 upvotes
    company logo
    Software Engineer
    3 rounds | 5 problems
    Interviewed by Microsoft
    1116 views
    0 comments
    0 upvotes
    Companies with similar interview experiences
    company logo
    Software Engineer
    3 rounds | 7 problems
    Interviewed by Optum
    7976 views
    1 comments
    0 upvotes
    company logo
    Software Engineer
    2 rounds | 4 problems
    Interviewed by Amazon
    4448 views
    1 comments
    0 upvotes
    company logo
    Software Engineer
    3 rounds | 5 problems
    Interviewed by Amazon
    3674 views
    0 comments
    0 upvotes