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

SDE - 1

Microsoft
upvote
share-icon
4 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 12 months
Topics: Data Structures, Algorithms, OS, OOPS, DBMS
Tip
Tip

Tip 1 : Be consistent
Tip 2 : Practice DSA along with basics of computer science.
 

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

Tip 1 : Keep it 1 pager and ATS friendly if off-campus. Also, keep it grammar error free.
Tip 2 : List projects with crisp and catchy description and your skills should be clearly visible.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 minutes
Interview date11 Aug 2021
Coding problem3

It was online in day time.

1. Balanced parentheses

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

Given an integer ‘N’ representing the number of pairs of parentheses, Find all the possible combinations of balanced parentheses with the given number of pairs of parentheses.

Note :

Conditions for valid parentheses:
1. All open brackets must be closed by the closing brackets.

2. Open brackets must be closed in the correct order.

For Example :

()()()() is a valid parentheses.
)()()( is not a valid parentheses.
Problem approach

The idea is to put all the opening brackets in the stack. Whenever you hit a closing bracket, search if the top of the stack is the opening bracket of the same nature. If this holds then pop the stack and continue the iteration, in the end if the stack is empty, it means all brackets are well-formed . Otherwise, they are not balanced.

Try solving now

2. Encrypt The Digits

Easy
10m average time
90% success
0/40
Asked in company
Microsoft

Given a numeric string ‘STR’ which is a string containing numeric characters from ‘0’ to ‘9’, you have to encrypt the string by changing each numeric character as shown below:

‘0’ -> ‘9’

‘1’ -> ‘8’

‘2’ -> ‘7’ and so on till ‘9’ -> ‘0’

For Example :
If ‘STR’ = “8034”, then the encrypted string will be “1965”.
Try solving now

3. IP address

Easy
0/40
Asked in company
Microsoft

You are given a string “S” containing only digits from 0 to 9. Your task is to find all possible IP addresses that can be obtained from S in lexicographical order. If no valid IP address can be generated from S, return an empty string.

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 if they are zero).

For example-
Following are valid IP addresses. 
0.1.24.255 
18.5.244.1

Following are invalid IP addresses. 
2.01.24.255 
18.312.244.1
Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date13 Aug 2021
Coding problem2

It was online teams meeting interview round for 1 hour. Interviewer asked me 2 medium-hard coding questions. He was friendly.

1. Search in Rotated Sorted Array

Moderate
30m average time
65% success
0/80
Asked in companies
InformaticaDelhiveryGoldman Sachs

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4, 5] and if he rotates it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, Aahad needs to answer Q queries asked by Harshit, each of them is described by one integer Q[i]. which Harshit wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where 'key' denotes Q[i]. If the key exists in the array, return the index of the 'key', otherwise, return -1.

Note:

Can you solve each query in O(logN) ?
Problem approach

The idea is to create a recursive function to implement the binary search where the search region is [l, r]. For each recursive call:

We calculate the mid value as mid = (l + h) / 2
Then try to figure out if l to mid is sorted, or (mid+1) to h is sorted
Based on that decide the next search region and keep on doing this till the element is found or l overcomes h.

Try solving now

2. Encode and Decode

Easy
15m average time
85% success
0/40
Asked in companies
Goldman SachsExpedia GroupMicrosoft

Tiny URL is an online URL shortening service, where you get a short version of a given URL as a substitute.

Your task is to design encode the original URL “S”, into a tiny URL and decode the previously encoded tiny URL into the original URL.

Example:

S= “https://youtu.be/dQw4w9WgXcQ”, can be encoded to TinyUrl “http://tinyurl.com/abcdef”, then in future queries “http://tinyurl.com/abcdef”  can be decoded into “https://youtu.be/dQw4w9WgXcQ”

Note:

The URL given to you for decoding will always be one of the URLs you have already returned after encoding in the past.

The encoded URL should strictly be of the format “http://tinyurl.com/abcdef”, where instead of “abcdef” you can have any alphanumeric code of length 6.
Problem approach

1. Pick the first character from the source string. 
2. Append the picked character to the destination string. 
3. Count the number of subsequent occurrences of the picked character and append the count to the destination string. 
4. Pick the next character and repeat steps 2, 3 and 4 if the end of the string is NOT reached.

Try solving now
03
Round
Medium
Video Call
Duration50 minutes
Interview date14 Aug 2021
Coding problem2

It was teams meeting. Interviewer asked me 1 DSA question and 1 system design question.

1. System Design Question

How can a database impact the scalability and speed of a system?

Problem approach

Tip 1 : Do study basics of system design
Tip 2 : Have an understanding of caching, scalability, database indexing etc.
 

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.
Try solving now
04
Round
Easy
HR Round
Duration30 minutes
Interview date15 Aug 2021
Coding problem2

30 minutes friendly interview

1. Technical Question

Intro and Resume walkthrough.

Problem approach

Tip 1 : Prepare your intro beforehand
Tip 2 : Focus on important things in resume and try to end your intro at a topic in which you have good knowledge. Most probably, interviewer will ask questions from last topic discussed.
 

2. Technical Question

Some tasks you did to show leadership qualities.

Problem approach

Tip 1 : Try to give some real example.
Tip 2 : Keep it positive
 

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
1273 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
21830 views
4 comments
0 upvotes