Microsoft Corporation
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
I was interviewed before May 2021.
Round duration - 60 minutes
Round difficulty - Medium
This was the first round. The interviewer discussed two coding problems with me.
You are given a binary tree of distinct integers, along with two nodes, ‘X’ and ‘Y’. Your task is to determine the Lowest Common Ancestor (LCA) of ‘X’ and ‘Y’.
The LC...
Find the Lowest Common Ancestor of two nodes in a binary tree.
Traverse the binary tree to find the paths from the root to nodes X and Y.
Compare the paths to find the last common node, which is the LCA.
Handle cases where one node is an ancestor of the other.
Consider using recursion to solve the problem efficiently.
Given two sorted arrays A
and B
of sizes N
and M
, find the median of the merged array formed by combining arrays A
and B
. If the total number of elements, N + M
, is even, the m...
Find the median of two sorted arrays by merging them and calculating the middle element(s).
Merge the two sorted arrays into one sorted array.
Calculate the median based on the total number of elements in the merged array.
If the total number of elements is even, take the mean of the two middle elements as the median.
Round duration - 45 minutes
Round difficulty - Easy
This was the second round. We started with a brief introduction. The interviewer then asked one coding problem and we had a long discussion on that problem only.
After years of research, Ninja has invented a time machine and found himself in the era where T9 keypads were commonly used in mobile phones. Being curious, Ninja seeks ...
Given a string of digits from 2 to 9, determine all possible strings that can be generated using T9 keypad letter mappings.
Create a mapping of digits to corresponding letters on a T9 keypad
Use recursion to generate all possible combinations of letters for the input string
Sort the generated strings lexicographically
Return the array of generated strings
Round duration - 40 minutes
Round difficulty - Easy
This was a typical managerial round. We started with a brief introduction. Then, the interviewer moved to my projects and started asking questions on one of the projects that he found interesting. At last, he asked me some questions based on Operating Systems.
Tip 1 : Practice DSA questions regularly from coding platforms.
Tip 2 : Have a clear understanding of the OS, DBMS and OOPS concepts.
Tip 3 : Be proficient in one programming language.
Tip 1 : Resume should be of 1-page only.
Tip 2 : Focus more on sections like Work Experience, Projects etc.
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Easy
This round consists of 3 coding questions with a total time limit of 90 minutes. The first two questions were of easy level and the third question was of medium level. No two candidates had the same set of questions, the distribution of questions was random. The test was conducted on mettl platform with both audio and video on for monitoring on the candidate.
Given a stream of integers, calculate and print the median after each new integer is added to the stream.
Output only the integer part of the median.
N = 5
Stre...
Calculate and print the median after each new integer is added to the stream.
Use two heaps - a max heap to store the smaller half of the numbers and a min heap to store the larger half.
Keep the sizes of the two heaps balanced to efficiently calculate the median.
If the total number of elements is odd, the median will be the top element of the max heap.
If the total number of elements is even, the median will be the avera
You are given 'n' fruit trees planted along a road, numbered from 0 to n-1. Each tree bears a fruit type represented by an uppercase English alphabet. A Ninja walking ...
The Ninja must collect fruits from trees in consecutive order, maximizing the number of fruits in two baskets.
Iterate through the trees while keeping track of the types of fruits collected in each basket.
Use a sliding window approach to find the maximum number of fruits collected.
Keep track of the count of each fruit type encountered to handle the condition of only two types of fruits in each basket.
You are given D
dice, each having F
faces numbered from 1 to F
. The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up num...
The task is to determine the number of possible ways to roll all the dice such that the sum of the face-up numbers equals the given 'target' sum.
Use dynamic programming to solve the problem efficiently.
Create a 2D array to store the number of ways to achieve each sum with the given number of dice.
Iterate through the dice and faces to calculate the number of ways to reach each sum.
Return the result modulo 10^9 + 7.
Optim...
Round duration - 50 miutes
Round difficulty - Medium
This was my first interview and I was a bit nervous. The interview was conducted on Microsoft Team. He told me to share my screen and write the pseudo code on notepad. The interviewer was very friendly and also gave me hints for the question. However, he mostly focused on optimization of the code. At the end of the question, few questions related to Operating Systems were asked.
Given an array or list of strings called inputStr
, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one anoth...
Group anagrams in an array of strings based on character frequency.
Iterate through each string in the input array
For each string, sort the characters and use the sorted string as a key in a hashmap to group anagrams
Return the grouped anagrams as arrays of strings
Round duration - 45 minutes
Round difficulty - Medium
The second round consisted questions related to concepts of object oriented programming and databases. At the end of the interview he asked me to explain any one good project. The interview lasted for 45 minutes. The interviewer was friendly and good.
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
The Merge Sort...
Implement Merge Sort algorithm to sort a given sequence of numbers in non-descending order.
Divide the input array into two halves recursively until each array has only one element.
Merge the sorted halves to produce a completely sorted array.
Time complexity of Merge Sort is O(n log n).
Round duration - 30 minutes
Round difficulty - Easy
This was my last round and I was a bit tensed. It was an HR round. The interviewer was very professional. He discussed and asked questions about my various achievements, my interests apart from the technical field and also asked about my projects. I made sure to answer all the questions confidently and calmly.
Tip 1 : Having a grip over Data Structures and Algorithms is very important. Have your concepts crystal clear and then pick one coding platform( for example, leetcode, InterviewBit, CodeZen, GeeksForGeeks) and try to practice around 7-10 questions everyday with varying difficulty and different topics. I completed around 200+ questions on leetcode, 200+ questions on geeks for geeks and around 30-40 problems on InterviewBit.
Tip 2 : After writing code for a particular question try to analyze its time and space complexity. Think about how you can optimize your code further. Also refer to the editorials and compare your solution with it. Interviewers ask a lot about further code optimization. Hence, instead of trying to solve more and more problems, try to analyze a question completely and understand the concept behind them.
Tip 3 : Along with coding, study about OOPS. Coding Ninja's Data Structures and Algorithms course helped a lot in preparing the OOPS concepts specifically. Also, OS and DBMS must also be studied. You can refer to GeekForGeeks articles for these topics.
Tip 4 : Keep participating in coding contests. It helps you increase your speed. I participated in almost every Leetcode Weekly Contest which helped me keeping the track of my improvement.
Tip 1 : Do not fake any skills, projects or achievements. The interviewer gets to know about it by asking questions to you.
Tip 2 : You do need to have a long list of projects. Any 1 good project with proper knowledge of it will also do good. Similarly, you do need to have many skills to be listed down. Few skills but with proper knowledge is great.
Tip 3 : Try to write achievements which proves your technical skills, communication skills, leadership quality or teamwork.
What people are saying about Microsoft Corporation
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
The online coding round took place at 9:30 am in the morning. The platform was new so I got familiar with it in advance, a night before, to avoid any hassle during the test. There was camera proctoring and laptop screen sharing throughout the test. Multiple programming languages like Java, C, C++ and Python were allowed. There were 3 coding questions based on DSA. Questions were different for different candidates.
You are provided with an array of strings, and your objective is to determine the number of unique strings within it.
A string is deeme...
Given an array of strings, determine the number of unique strings that cannot be transformed into another string by swapping characters at odd or even indices.
Iterate through each string in the array and check if it can be transformed into another string by swapping characters at odd or even indices.
Keep track of unique strings that cannot be transformed and return the count.
Example: For array = ["abcd", "cbad", "bdac"...
Given two strings 'P' and 'Q' of equal length, determine if string 'P' can be transformed into string 'Q' by cyclically rotating it to the right any num...
Check if one string can be transformed into another by cyclically rotating it to the right.
Iterate through all possible rotations of string P and check if any of them match string Q.
Use string concatenation to simulate cyclic rotations efficiently.
Compare the rotated strings with string Q to determine if they are equivalent.
You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that...
Given an array representing number of buses at each bus stop, determine how many buses originate from each stop.
Iterate through the array and for each element, increment the count of buses originating from the corresponding bus stop.
Use an array to store the count of buses originating from each stop.
Remember to consider the constraint of 1-based indexing for bus stops.
Round duration - 45 Minutes
Round difficulty - Medium
The interview took place through Microsoft Teams at 2:00 pm. The platform was smooth and the interviewer was very friendly and told me that he isn't looking for bookish language answers but he only wants to check my understanding of CS subjects.
Given an array of integers representing the heights of mountains, determine the length of the longest subarray that forms a mountain shape.
A mountain subarray...
Find the length of the longest mountain subarray in an array of integers.
Iterate through the array to find peaks.
Expand from peaks to find ascending and descending slopes.
Track the length of the mountain subarray and return the maximum length.
Round duration - 55 Minutes
Round difficulty - Medium
The interview was conducted on Microsoft Teams and the interviewer was very friendly. He made sure I was comfortable and described his role at Microsoft.
Given an array containing N
distinct positive integers and a number K
, determine the Kth largest element in the array.
N = 6, K = 3, array = [2, 1, 5, 6, 3, ...
Find the Kth largest element in an array of distinct positive integers.
Sort the array in non-increasing order and return the Kth element.
Use a sorting algorithm like quicksort or heapsort for efficiency.
Ensure the array contains distinct positive integers for accurate results.
ACID properties in DBMS ensure data integrity and consistency.
Atomicity: All transactions are either fully completed or fully aborted. For example, transferring money from one account to another should be completed in its entirety.
Consistency: The database remains in a consistent state before and after the transaction. For example, if a constraint is violated during a transaction, the transaction will be rolled back.
Is...
Round duration - 60 Minutes
Round difficulty - Hard
The interview was conducted on Microsoft Teams and code was written on Notepad (screen shared). The interviewer was friendly and gave hints to reach the final solution.
Design a data structure that supports four operations: insert an element, remove an element, search for an element, and get a random element. E...
Design a data structure supporting insert, delete, search, and getRandom operations in constant time.
Use a combination of hashmap and array to achieve O(1) time complexity for all operations.
For insert operation, check if element exists in hashmap, if not add to array and hashmap.
For remove operation, check if element exists in hashmap, if yes, remove from array and hashmap.
For search operation, check if element exists...
You are given a Binary Search Tree (BST), and your task is to convert it into a sorted Doubly Linked List (DLL).
Consider the provided BST. The goal is ...
Convert a Binary Search Tree to a sorted Doubly Linked List efficiently.
Implement a function to convert a BST to a sorted DLL.
Use in-order traversal to efficiently convert the BST to DLL.
Maintain pointers for the head and tail of the DLL.
Ensure the left child of a node becomes the previous node and the right child becomes the next node in the DLL.
Tip 1 : The most important topic to prepare is DSA, everything else is secondary. Don't run behind advanced technologies if your DSA concepts are not strong.
Tip 2 : Make sure you know the fundamentals of the programming language you code in, apart from OS, OOP and DBMS concepts. Knowledge of these topics showcase your interest in Computer Science, in general.
Tip 3 : Practice by giving contests on Leetcode and other coding platforms. Don't focus on your score or rank, just focus on your learning.
Tip 1 : Make sure your resume is well structured and only 1 page, if you are a fresher. It should include relevant sections like Work Experience (Any past internships), PORs (Any college society you were a part of), Personal Projects and Achievements that you wish to showcase.
Tip 2 : Proofread your resume multiple times. Get it reviewed by your seniors or your friends to ensure there are no grammatical mistakes or spelling errors as it gives a bad impression.
Microsoft Corporation interview questions for popular designations
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
The round consists of 3 coding questions and the test was conducted on mettl platform. There was no sectional time limit for the coding questions. Every student got randomly 3 coding questions and none of the students got the same set of questions. The test was online with audio and video both on for continuous monitoring.
You are given an array 'ARR' consisting of 'N' integers. Your task is to calculate the three statistical measures for the given array:
mean...
Implement functions to calculate mean, median, and mode of an array of integers.
Implement a function mean() to calculate the mean of the array by summing all elements and dividing by the total count.
Implement a function median() to calculate the median of the array by sorting the array and finding the middle element(s).
Implement a function mode() to find the mode of the array by counting frequencies and returning the s
Determine the Nth term of a geometric progression (GP) series given the first term, common ratio, and the term number.
The general form of a GP...
Calculate the Nth term of a geometric progression series given the first term, common ratio, and term number.
Use the formula for the Nth term of a GP series: A * (R^(N-1))
Ensure to take the modulo 10^9 + 7 as the output
Handle multiple test cases efficiently within the given time limit
You are provided with D
dice, each having F
faces numbered 1 to F
, inclusive. Your task is to determine the number of possible ways to roll the dice such that the sum of the f...
The problem involves finding the number of ways to achieve a target sum by rolling a given number of dice with a certain number of faces.
Use dynamic programming to keep track of the number of ways to achieve each sum from 1 to the target sum.
Iterate through the dice and faces to update the number of ways to reach each sum.
Return the number of ways to achieve the target sum modulo 10^9 + 7.
Round duration - 50 minutes
Round difficulty - Medium
This round was based on data structures and some discussion regarding the projects. The interviewer was very calm and listened very carefully to the solutions. There was a lot of discussion on my projects and the interviewer seems to be very interested in knowing about the workflows of my projects.
Given two binary trees with 'N' and 'M' nodes respectively, determine if the two trees are identical. Return true
if they are identical, otherwise return false
.
...
Check if two binary trees are identical by comparing their nodes in level order.
Traverse both trees in level order and compare corresponding nodes for equality
Use a queue to keep track of nodes to be compared
Return false if nodes are not equal or if one tree has more nodes than the other
Given a string S
of length N
that may contain duplicate alphabets, your task is to compute the count of distinct subsequences of this string.
S = "deed...
Compute the count of distinct subsequences of a string with possible duplicates.
Use dynamic programming to keep track of distinct subsequences.
Consider the cases where the current character is included or excluded in the subsequence.
Use a hashmap to store the last occurrence index of each character to handle duplicates efficiently.
Round duration - 50 minutes
Round difficulty - Medium
This round was also based on data structures and the interviewer was not responding as much as in the first round so that I should think on my own that whether I am on right track or not. In this round also there was a deep discussion on one of my web development with machine learning project. So don't panic in these situations If the interviewer is not responding much because he is noting down every tiny detail of your written code.
This problem requires you to delete the Kth node from the end of a given singly linked list with N nodes containing integer data.
You are asked to efficiently remo...
To delete the Kth node from the end of a singly linked list efficiently without finding the length of the list and using O(1) extra space.
Use two pointers approach - one pointer moves K steps ahead of the other.
When the first pointer reaches the end, the second pointer will be at the Kth node from the end.
Adjust the pointers to remove the Kth node efficiently.
Ensure to handle edge cases like deleting the head or tail n...
Round duration - 30 minutes
Round difficulty - Medium
This was an HR/Coding round and was the final one. The coding question was to find the nth node from the end of the linked list which is similar to the one asked in the previous round. The interview started with 2-3 HR questions and after I answered all of them, there was a serious discussion on my projects like why did you chose this project, what are its advantages, was it able to solve the existing problem. I answered all the project related queries very calmly and he was satisfied.
Tip 1 : I would suggest practicing as many questions on data structures and algorithms as you can because it is the question practice that would help you in building your concepts strong. I practiced a lot of questions on InterviewBit and completed all modules of data structures and algorithms because there you can find the recent interview questions that you should know.
Tip 2 : If you have time for your interviews, I would recommend going through Leetcode as it has a good variety of questions sorted on topic wise difficulty level where you can try to solve at least 20-30 questions for each data structure and algorithm. Moreover, you should regularly participate in the weekly contests happening there so that you could know about your weak areas to improve.
Tip 3 : Along with coding you should be clear about some basic concepts of Operating systems and Databases that would help in your interviews. One more thing is that do some good research about the company's goal and vision and be prepared to ask some company-related queries that show your interest in the company.
Tip 1 : Your Resume should consist of mainly skills, projects, and achievements. Projects would play a crucial part in your interview and you should have at least one most relevant and good project that shows how strong your concepts are in development.
Tip 2 : The most important tip is that never lie on your resume and like If you have worked upon some technology for the project part only and don't know the proper depth you could write basics only in your resume.
Get interview-ready with Top Microsoft Corporation Interview Questions
I was interviewed in Jan 2021.
Round duration - 60 Minutes
Round difficulty - Easy
It was an online technical interview focusing on DS and algorithms. They asked two questions in this round. He also asked me to code both the questions. I solved both questions with confidence.
They also gave a puzzle to solve. Out of 32 they selected 22 students along with me.
You are given a N x M
matrix of integers. Your task is to return the spiral path of the matrix elements.
The first line contains an integer 'T' which denotes the nu...
The task is to return the spiral path of elements in a given matrix.
Iterate through the matrix in a spiral path by adjusting the boundaries of rows and columns.
Keep track of the direction of traversal (right, down, left, up) to cover all elements.
Print the elements in the spiral path as you traverse the matrix.
Handle edge cases like when the matrix is a single row or column.
Optimal strategy to minimize number of drops to find highest floor an egg can be dropped without breaking.
Start by dropping the first egg from a lower floor and incrementally increase the floor until it breaks.
Once the first egg breaks, use the second egg to perform a binary search between the last successful drop and the floor below the breaking point.
This strategy ensures the minimum number of drops required to find
Tip 1 : Focus on your data structure and algorithms part, these plays a crucial role in clearing the test.
Tip 2 : Don't lie on your resume.
Tip 3 : Mention one or two good projects on your resume.
Tip 1 : Have some good projects on resume and know everything about your projects.
Tip 2 : Write only what you know. Don't lie anything on resume as they will find out.
I was interviewed before Dec 2020.
Round duration - 90 minutes
Round difficulty - Easy
The test was held on Mettl Platform in online mode from 10:00-10:15 AM joining time for 90 minutes.
Convert a given infix expression, represented as a string EXP
, into its equivalent postfix expression.
An infix expression is formatted as a op b
where the opera...
Convert infix expression to postfix expression.
Use a stack to keep track of operators and operands.
Follow the rules of precedence for operators.
Handle parentheses to ensure correct order of operations.
You are given two strings 'A' and 'B' composed of words separated by spaces. Your task is to determine the most frequent and lexicographically smallest word in string ...
Find the most frequent and lexicographically smallest word in string 'A' that is not present in string 'B'.
Split strings 'A' and 'B' into words
Count frequency of each word in 'A'
Check if word is not in 'B' and is the most frequent and lexicographically smallest
Return the word or -1 if no such word exists
Given a string str
and a string pat
, where str
may contain wildcard characters '?' and '*'.
If a character is '?', it can be replaced with any single character....
Given a string with wildcard characters, determine if it can be transformed to match another string.
Iterate through both strings simultaneously, handling wildcard characters '?' and '*' accordingly.
Use dynamic programming to keep track of matching characters.
Handle cases where '*' can match an empty sequence or multiple characters.
Return true if at the end both strings match, false otherwise.
Tip 1 : Try to give the weekly and biweekly contests on LeetCode before atleast 2-3 months from the start of interviews as these questions are mainly based on Data Structures, most of these are directly asked in interviews. These will also help in accelerate your speed of writing codes and it will help during interviews as we are often asked to write codes or pseudocodes most of the times. I followed this approach and got a lot of benefit.
You can check my LeetCode Profile here: https://leetcode.com/vsam09_iitg/
Tip 2 : Try to complete the Interview Bit or LeetCode (prefer only one as both have similar type of questions) before the start of interviews and start solving it from 3 months before as it will took time to complete it. If you get stuck in some question, don't try to directly see the solutions. First try to see the hints mentioned there. Then try to read the discussion forum and try to code it yourself. This approach will help you as sometimes same questions are being asked in the interviews and if we haven't coded it yourself then sometimes it creates trouble in the important interviews.
Tip 3 : Try to maintain 2-3 good projects in which you can speak for about 10-15 minutes. Try to have a complete or necessary background information about the technical details of the project. For example in Web Development projects, try to have necessary information on Database Management.
Tip 4 : Do give mock interviews on interview bit/ proxy before the interviews as it will help you in kept calm and confident during the interviews and help you to better explain the interviewer your explanations regarding your solutions.
Tip 1 : Try to showcase only important information in each section. For example in Projects section, try to list the purpose of the project, how it is beneficial for others, technologies it uses etc.
Tip 2 : Try to make the resume as precise and short as possible since most of the interviewers prefers short and clear resumes as it makes easier for them to ask different questions.
Tip 3 : Try to highlight the important points in which you are proficient or if it is a big achievement in bold as it directs the attention of the interviewer towards those points more and is often likely to ask about those points.
Tip 4 : Try to have some good achievements regarding coding events and hackathons like good rank in Google KickStart, good LeetCode Rating etc as it will help you to showcase yourself to interviewer in your coding skills and different areas.
I applied via Recruitment Consultant and was interviewed in Dec 2020. There was 1 interview round.
I have 5 years of experience in sales with a proven track record of meeting and exceeding quotas.
I have 5 years of experience in sales
I consistently met and exceeded my assigned quotas
I achieved a target of 120% in the last fiscal year
I have a strong understanding of the sales process and techniques
I have successfully closed deals with high-value clients
I worked on an analytics case study where we helped a retail company optimize their inventory management.
The client was looking to reduce their inventory costs while ensuring they always had enough stock to meet demand.
We analyzed their sales data and identified patterns in customer behavior and seasonal trends.
We recommended implementing a predictive analytics tool to forecast demand and optimize inventory levels.
The ...
Serialize a tree data structure
Use pre-order traversal to serialize the tree
Store null values as a special character
Use a delimiter to separate nodes
Example: 1,2,null,null,3,4,null,null,5,null,null
Deserialize by splitting the string and using a queue
I was interviewed before Oct 2020.
Round duration - 60 minutes
Round difficulty - Medium
Timing-> EVENING(5 TO 6)
The interviewer was very sweet and calm.
Determine if a given singly linked list of integers forms a cycle or not.
A cycle in a linked list occurs when a node's next
points back to a previous node in the ...
Detect if a singly linked list forms a cycle by checking if a node's next pointer points back to a previous node.
Use Floyd's Cycle Detection Algorithm to determine if there is a cycle in the linked list.
Maintain two pointers, one moving at twice the speed of the other.
If the two pointers meet at any point, there is a cycle in the linked list.
Given a binary tree of integers, your task is to return the boundary nodes of the tree in Anti-Clockwise direction starting from the root node.
The first line ...
Return the boundary nodes of a binary tree in Anti-Clockwise direction starting from the root node.
Traverse the left boundary nodes in a top-down manner
Traverse the leaf nodes in a left-right manner
Traverse the right boundary nodes in a bottom-up manner
Avoid duplicates in boundary nodes
Tip 1 : Your basics should be clear.
Tip 2 : Practice At least 200+ Questions
Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume
Some of the top questions asked at the Microsoft Corporation interview -
The duration of Microsoft Corporation interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 375 interviews
Interview experience
based on 1.7k reviews
Rating in categories
Software Engineer
1.6k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Software Engineer
1.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Software Engineer2
1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Software Developer
762
salaries
| ₹0 L/yr - ₹0 L/yr |
Consultant
600
salaries
| ₹0 L/yr - ₹0 L/yr |
Amazon
Deloitte
TCS