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

SDE - 1

Microsoft
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Java, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 : Practice at least 250 Questions

Tip 2 : Do good projects

Tip 3 : Don't take long gaps in between your coding days

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

Tip 1 : Keep it short and precise.
Tip 2 : Do not put false things on resume.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration60 minutes
Interview date16 May 2022
Coding problem2

Coding test of 90 minutes comprising 2 coding questions

1. Minimum Parentheses

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

Given a string "pattern", which contains only two types of characters ‘(’, ‘)’.

Your task is to find the minimum number of parentheses either ‘(’, ‘)’ we must add the parentheses in string ‘pattern’ and the resulted string is valid.

Condition for valid string-

Every opening parenthesis ‘(’ must have a correct closing parenthesis ‘)’.

Example - ‘(()(()))’, ‘()()()’, ‘((()))’ are valid string, and ‘(((’, ‘(()’, ‘)(())’ are invalid string.

Note:
1. You are not required to print the output explicitly, it has already been taken care of. Just implement the function and return the minimum number of parentheses required to make a string valid.
Problem approach

We keep the track of balance of the string i:e the number of ‘(‘ minus the number of ‘)’. A string is valid if its balance is 0, and also every prefix has non-negative balance.

Try solving now

2. Complete Substring!

Moderate
30m average time
60% success
0/80
Asked in companies
AdobeDailyhuntMakeMyTrip

You are given two strings ‘S1’ and ‘S2’. Your task is to find the smallest substring of ‘S1’ which contains all the characters of ‘S2’. The characters of ‘S2’ need not be present in the same order in S1. That is, we need a substring that contains all characters of ‘S2’ irrespective of the order.

A substring is a contiguous sequence of characters within a string.

Example

Let ‘S1’ be “ABBCD” and ‘S2’ be “ABC”, so the smallest substring of ‘S1’ which contains all the characters of S1 is “ABBA”.
Problem approach

Idea is to generate all possible substring of the given string S and store the frequency of each substring in a HashMap

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date18 May 2022
Coding problem1

The interviewer has provided a codility link and asked me to solve a single problem.

1. Ninja And The Tree

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

Ninja is learning tree data structure these days. While learning, she came across learn about the Binary Search tree. She found BST quite interesting. She decided to make her own Binary Search Tree. Being a newbie, she made a mistake and swap two nodes of the Binary Search Tree.

Your responsibility being an expert and a good friend is to correct the Binary Search Tree made by Ninja and recover the correct Binary Search Tree.

A binary search tree (BST) is a binary tree data structure with the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
Example

This is the binary search tree made by Ninja. But here, the left node of 8 is greater, and the right node is smaller.
If we swap the right and the left node of 8 Ninja’s Binary Search Tree will become correct.

This is the correct binary Search Tree.
Problem approach

Traverse the BST in In-order fashion and store the nodes in a vector.

Try solving now
03
Round
Hard
Video Call
Duration60 minutes
Interview date21 May 2022
Coding problem2

The interviewer has given a codility link with two problems and asked me to solve them.

1. Two City Scheduling

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

Ninja is planning to organize an exhibition in which ‘2N’ peoples are coming. The hall’s capacity in which the exhibition is going to take place is only ‘N’. So, ninja thinks of organizing two exhibitions in 2 different cities, ‘CITY_A’ and ‘CITY_B’, each of capacity ‘N’. All ‘2N’ people will come to the exhibition but in the group of ‘N’ in two different cities. Ninja wants your help in organizing this event.

You are given an array ‘COST’ where “COST[i] = [COST_TO_Ai, COST_TO_Bi]”, in which ‘COST_TO_Ai’ is the cost of the ith person to fly to the city A, and ‘COST_TO_Bi’ is the cost of the ith person to fly to the city B. Your task is to find the minimum cost of organizing the exhibition in which every person flies to a city such that exactly ‘N’ people arrive in each city.

Note:

The intersection of the set of the persons who go to ‘CITY_A’ to those going to ‘CITY_B’ is to be disjoint set, whereas the union must be the ‘2N’.
Problem approach

I sorted the array based on the difference in the cost of both cities. Sorting can be done using a comparator interface in Java.

Try solving now

2. Restore IP Addresses

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

You are given a string 'S' containing only digits. Your task is to find all possible IP addresses that can be obtained from string 'S' in lexicographical order.

Note:
A valid IP address consists of exactly four integers, each integer is between 0 and 255 separated by single dots, and cannot have leading zeros except in the case of zero itself.
For example:
The following are valid IP addresses:
0.1.24.255
18.5.244.1

Following are invalid IP addresses:
0.01.24.255  (as  01  contains one leading zero).
18.312.244.1 (as 312 not lies between 0 and 255).
Problem approach

Split the string with ‘ . ‘ and then check for all corner cases. Before entering the loop, check the size of the string. Generate all the possible combinations using looping through the string. If IP is found to be valid then return the IP address, else simply return the empty list.

Try solving now

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
2660 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