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

SDE - Intern

Microsoft
upvote
share-icon
4 rounds | 6 Coding problems

Interview preparation journey

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

Tip 1 : Practice various questions
Tip 2 : Do good projects

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

Tip 1 : Do relevant projects 
Tip 2 : Resume should be of one page

Interview rounds

01
Round
Easy
Online Coding Interview
Duration60 minutes
Interview date28 Sep 2019
Coding problem2

1. Largest Component

Moderate
45m average time
55% success
0/80
Asked in companies
OlaMicrosoftChegg Inc.

You are given an array 'ARR' of size 'N' containing positive integers. Consider an undirected graph using the given array with the following conditions:

-> The graph consists of 'N' vertices.
-> The ith vertex has a value 'ARR[i]'.
-> There is an edge between two vertices 'i' and 'j' (where 'i' < 'j'), if and only if GCD('ARR[i]', 'ARR[j]') is greater than 1.

GCD(a, b) is the maximum number x such that both a and b are divisible by x.

Your task is to find the size of the largest component in the graph.

A component of an undirected graph is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the rest of the graph. The size of a component is the number of vertices in it.

Problem approach

Used DSU and a bit of maths

Try solving now

2. Square Submatrix with sum less than or equal to K

Moderate
30m average time
70% success
0/80
Asked in companies
MicrosoftWolters KluwerTrilogy Innovations

Given a 2-dimensional matrix of size ‘N’ x ‘M’ and an integer K. Find the size of the largest square sub-matrix whose sum is less than or equal to K. The size of a matrix is the product of rows and columns in it.

A sub-matrix is a matrix obtained from the given matrix by deletion of several (possibly, zero or all) rows/columns from the beginning and several (possibly, zero or all) rows/columns from the end. A square matrix is a matrix which has the same number of rows and columns.

For Example

example

Note
If there is no square sub-matrix with a sum less than or equal to K, then return 0.
Problem approach

Used Binary Search to solve this problem - 

If S is the sum of a square submatrix whose top-left corner is (R, C) and contains L number of rows/columns, then the sum of the square submatrix with the same top-left corner, containing (L+1) number of rows/columns is always greater than or equal to S (since the matrix contains non-negative integers).

 

It means using binary search we can find the largest square submatrix whose top-left corner is (R, C).

Try solving now
02
Round
Easy
Telephonic
Duration60 minutes
Interview date16 Oct 2019
Coding problem2

1. Reverse Linked List

Moderate
15m average time
85% success
0/80
Asked in companies
WalmartHCL TechnologiesInfo Edge India (Naukri.com)

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked list is 4 -> 3 -> 2 -> 1 -> NULL and the head of the reversed linked list will be 4.
Follow Up :
Can you solve this problem in O(N) time and O(1) space complexity?
Problem approach

A very standard problem. Coded both recursive as well as iterative solutions

Try solving now

2. Decode Ways

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

Given a string ‘strNum’ which represents a number, your task is to find the ways to decode the given string ‘strNum’.

The format of encoding is as follows: ‘A’ - 1, ‘B’ - 2, ‘C’ - 3, ‘D’ - 4, ……………, ‘Z’ - 26.

Encoding is possible in letters from ‘A’ to ‘Z’. There is an encoding between character and number.

Example :

subsequence

‘n = 226’ so we can decode ‘226’ in such a way-

‘BZ = 2-26’, as B maps to 2 and Z maps to 26.

‘BBF = 2-2-6’

‘VF = 22-6’

‘226; can be decoded in three ‘BZ’, ‘BBF’, ‘VF’ possible ways.

Point to be noticed we can’t decode ‘226’ as ‘226’ because we have no character which can directly map with ‘226’ we can only decode numbers from ‘1’ to ‘26’ only.

Problem approach

Used recursion and DP

Try solving now
03
Round
Medium
Face to Face
Duration60 minutes
Interview date5 Dec 2019
Coding problem1

1. Shortest substring with all characters

Moderate
18m average time
85% success
0/80
Asked in companies
Natwest GroupIntuitChegg Inc.

You have been given a string 'S' which only consists of lowercase English-Alphabet letters.

Your task is to find the shortest(minimum length) substring of 'S' which contains all the characters of 'S' at least once. If there are many substrings with the shortest length, then find one which appears earlier in the string i.e. substring whose starting index is lowest.

For example-
If the given string is S = "abcba", then the possible substrings are "abc" and "cba". As "abc" starts with a lower index (i.e. 0, "cba" start with index 2), we will print "abc" as our shortest substring that contains all characters of 'S'.
Problem approach

Used 2 pointer sliding window

Try solving now
04
Round
Easy
HR Round
Duration15 minutes
Interview date5 Dec 2019
Coding problem1

This is a cultural fitment testing round. HR was very frank and asked standard questions. 

1. Basic HR Question

Tell me something not there in your resume.

Problem approach

If you get this question, it's an opportunity to choose the most compelling information to share that is not obvious from your resume.


Example :


Strength -> I believe that my greatest strength is the ability to solve problems quickly and efficiently, which makes me unique from others.


Ability to handle Pressure -> I enjoy working under pressure because I believe it helps me grow and become more efficient.


Tip : Emphasize why you were inspired to apply for the job. You can also explain that you are willing to invest a great deal of energy if hired. These are generally very open-ended questions and are asked to test how quick wit a candidate is. So there is nothing to worry about if you have a good command over your communication skills and you are able to propagate your thoughts well to the interviewer.

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 - Intern
3 rounds | 8 problems
Interviewed by Microsoft
2318 views
2 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
1353 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 5 problems
Interviewed by Microsoft
1986 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Microsoft
632 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15606 views
4 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10216 views
2 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by Amazon
6390 views
3 comments
0 upvotes