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

SDE - 1

Microsoft
upvote
share-icon
4 rounds | 7 Coding problems

Interview preparation journey

expand-icon
Journey
I started coding in the 2nd semester itself; I chose Java as my first language. After I gained a good grip on DSA, I began exploring web development and continued doing coding on the side.
Application story
I saw a post from an HR person on LinkedIn and requested that they consider me. After almost seven days of applying, I received an email from HR stating that I have been shortlisted to participate in further interview rounds.
Why selected/rejected for the role?
They had two interviews, after which 16 students were selected for the job; I was one of them. Overall, the interviews were pretty straightforward; anybody who prepared well from the start could have cracked it.
Preparation
Duration: 6 months
Topics: Topics: Data Structures, OS, DMBS, Operating Systems, Computer Networks, LLD
Tip
Tip

Tip 1: Start giving contests on online coding platforms as soon as you get a basic understanding of DSA.
Tip 2: Keep studying CS fundamentals from the very beginning.
Tip 3: Try solving low-level design problems as well.

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

Tip 1 : Maintain a good cgpa.
Tip 2 : Have at least 3 projects in your resume.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration60 minutes
Interview date15 May 2022
Coding problem1

1. Largest Distance Between Two Nodes In A Tree

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

You are given an arbitrary unweighted rooted tree which consists of N nodes, 0 to N - 1. Your task is to find the largest distance between two nodes in the tree.

The distance between two nodes is the number of edges in a path between the nodes (there will always be a unique path between any pair of nodes since it is a tree).

Note :
Use zero-based indexing for the nodes.

The tree is always rooted at 0.
Problem approach

Simple BFS worked

Try solving now
02
Round
Medium
Online Coding Test
Duration60 minutes
Interview date18 May 2022
Coding problem2

1. Square Root of a number

Easy
15m average time
80% success
0/40
Asked in companies
SamsungAmazonMicrosoft

You are given a positive integer ‘n’.


Your task is to find and return its square root. If ‘n’ is not a perfect square, then return the floor value of sqrt(n).


Example:
Input: ‘n’ = 7

Output: 2

Explanation:
The square root of the number 7 lies between 2 and 3, so the floor value is 2.


Problem approach

So he asked me to explain all approaches from brute force to the optimal solution, which he expected me to do in O(log n), and to use different methods for each implementation (different methods in the same code).

Try solving now

2. N Queens

Hard
55m average time
35% success
0/120
Asked in companies
AmazonAdobeIntuit

You are given an integer 'N'. For a given 'N' x 'N' chessboard, find a way to place 'N' queens such that no queen can attack any other queen on the chessboard.

A queen can be killed when it lies in the same row, or same column, or the same diagonal of any of the other queens. You have to print all such configurations.

Problem approach

I solved it using backtracking.

Try solving now
03
Round
Medium
Online Coding Test
Duration60 minutes
Interview date23 May 2022
Coding problem2

1. Minimum Time To Build Blocks

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

You are managing a project that is about building the blocks. You need ‘workers’ to build the ‘blocks’, and a block can only be built by exactly one worker (means once a worker assigned to a particular block he needs to finish it). A worker can either split into two workers or build a block then go home. There is an extra time cost associated with both of the operations.

You are given an array ‘BLOCK’ where ‘BLOCK[i]’ denotes the time required to build the ith block. You are also given an integer, ‘SPLIT’, which denotes the time required to split the worker. The process starts with only one worker. Your task is to find the “minimum time” required to build all the blocks.

Note:
Two or more workers may split simultaneously so that the cost would be ‘SPLIT’ at that time.
Try solving now

2. Flatten Binary Tree to Linked List

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

You are given a binary tree consisting of 'n' nodes.


Convert the given binary tree into a linked list where the linked list nodes follow the same order as the pre-order traversal of the given binary tree.


Use the right pointer of the binary tree as the “next” pointer for the linked list and set the left pointer to NULL.


Use these nodes only. Do not create extra nodes.


Example :
Input: Let the binary be as shown in the figure:

Example Tree

Output: Linked List: 15 -> 40 -> 62 -> 10 -> 20 -> NULL

Explanation: As shown in the figure, the right child of every node points to the next node, while the left node points to null.

Also, the nodes are in the same order as the pre-order traversal of the binary tree.
Problem approach

The root node of the tree is 1

Level 2 :
Left child of 1 = 2
Right child of 1 = 3

Level 3 :
Left child of 2 = 4
Right child of 2 = null (-1)
Left child of 3 = 5
Right child of 3 = 6

Level 4 :
Left child of 4 = null (-1)
Right child of 4 = 7
Left child of 5 = null (-1)
Right child of 5 = null (-1)
Left child of 6 = null (-1)
Right child of 6 = null (-1)

Level 5 :
Left child of 7 = null (-1)
Right child of 7 = null (-1)

The first not-null node(of the previous level) is treated as the parent of the first two nodes of the current level. The second not-null node (of the previous level) is treated as the parent node for the next two nodes of the current level and so on.
The input ends when all nodes at the last level are null(-1).

Try solving now
04
Round
Easy
HR Round
Duration30 minutes
Interview date30 May 2022
Coding problem2

1. OS Questions

What are the different operating systems? Batched operating systems
Distributed operating systems
Timesharing operating systems
Multi-programmed operating systems
Real-time operating systems

2. SQL Questions

Write an SQL query to fetch records that are present in one table but not in another table.

 

Problem approach

SELECT * FROM EmployeeSalary
MINUS
SELECT * FROM ManagerSalary;

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