Aiming for a career at Microsoft is a worthy challenge given the company’s excellent track record for technological innovation, generous compensation packages, and flexible work-life balance.
As the largest and arguably most influential software company in the world, prospective applicants may find the technical interview process daunting. However, familiarizing yourself with the type of technical questions that will be presented to you and learning to recognize coding patterns will help you navigate these interviews with greater confidence.
We’ll start with an introduction to 26 common coding questions, move on to an overview of the complete interview process for software engineers, move on to frequently asked technical questions, and then wrap up with additional guidance and resources to maximize your chances of receiving an offer.
Take some time to reflect on the efficiency of your solution, and try to see if you can make your answer more elegant by simplifying it.
Lastly, always remember to validate your solutions.
Alright, let’s dive in!
Problem Statement: Given an array of positive numbers ranging from 1 to
n, such that all numbers from 1 to
n are present except one number
x. Assume the input array is unsorted.
Problem Statement: Given an array of integers and a value, determine if there are any two integers in the array whose sum is equal to the given value. Return true if the sum exists, and false if it does not. Consider the following array and its target sums:
Problem Statement: Given a two-dimensional array, if any element within is zero, make its whole row and column zero. Consider the matrix below.
There are two zeros in the input matrix at positions (1,1) and (2,3). The output of this should be a matrix in which the first and second rows become zero and the first and third columns become zero. Below is the expected output matrix.
Problem Statement: Given the head pointers of two linked lists where each linked list represents an integer number (each node is a digit), add them and return the resulting linked list. In the example below, the first node in a list represents the least significant digit.
Problem Statement: You are given a linked list where the node has two pointers. The first is the regular
next pointer. The second pointer is called
arbitrary_pointer and it can point to any node in the linked list.
Here, deep copy means that any operations on the original list (inserting, modifying, and removing) should not affect the copied list.
Here’s an example of a linked list with arbitrary pointers connected.
Problem Statement: Write a function that takes two sorted linked lists and merges them. The function should return a single, sorted list made from splicing the nodes of the first two lists together.
For example, if the first linked list is
1 -> 2 -> 4 and the second linked list is
3 -> 5 -> 6, then the output would be
1 -> 2 -> 3 -> 4 -> 5 -> 6
Problem Statement: Given the root of a binary tree, display the node values at each level.
The level order traversal for this binary tree looks like this:
100 50, 20 25, 75, 350
Problem Statement: Connect the sibling pointer to the next node in the same level. The last node in each level should point to the first node of the next level in the tree.
Problem Statement: Given a binary tree, write a program that will return true if the binary tree is a mirror image of itself, and false if it is not.
The correct output given this binary tree would be
true because it is symmetrical.
Problem Statement: Reverse the order of words in a given sentence.
"sphinx of black quartz judge my vow" should output as
"vow my judge quartz black of sphinx"
Problem Statement: Given a string, find all non-single letter substrings that are palindromes.
An string input of
"poppopo" would return
Problem Statement: Given a dictionary of words and a large input string, find whether or not the input string can be completely segmented into the words of that dictionary.
Problem Statement: Given a list of daily stock prices (integers for simplicity), return the buy and sell prices that will maximize the single buy/sell profit. If you can’t make any profit, try to minimize the loss.
For the below examples, buy (orange) and sell (green) prices for making a maximum profit are highlighted.
Problem Statement: Given a one-dimensional integer array
a of length
n, find the length of the longest subsequence that increases before decreasing.
Problem Statement: Given an
n*n matrix where all numbers are distinct, find the longest path starting from any cell such that all cells along the path increase in order by 1.
Dynamic Programming (DP) questions can be some of the most challenging questions you’ll encounter in your programming interviews. To get more practice in this area, we recommend checking out Grokking Dynamic Programming Patterns for Coding Interviews!
Problem Statement: Given an array of positive numbers ranging from
n, such that all numbers from
n are present except one number
The input array is not sorted.
Problem Statement: Given a positive integer,
target, print all possible combinations of positive integers that sum up to the
For example, if we are given input ‘5’, these are the possible sum combinations.
1, 4 2, 3 1, 1, 3 1, 2, 2 1, 1, 1, 2 1, 1, 1, 1, 1
The output will be in the form of a list of lists or an array of arrays. Each element in the list will be another list containing a possible sum combination.
Problem Statement: Given a set of
n variables, find their
kth permutation. Consider the following set of variables:
Problem Statement: Given a text and a pattern, determine if the pattern matches the text completely or not at all using regular expression matching. Assume the pattern contains only two operators:
* in the pattern means that the character preceding
* may not appear or may appear any number of times in the text. Operator
. matches with any character in the text exactly once.
Below is an example of a text and its matching and non-matching patterns.
Problem Statement: Consider a rat placed in a square
n*n matrix at position
(0, 0). Find all possible paths the rat can take to reach its destination
(N-1, N-1) from its starting position.
The rat can move vertically and horizontally. Cells with a value of 1 can be traversed, while cells with a value of 0 cannot. The rat cannot visit a cell more than once.
Problem Statement: Given a square matrix grid of
9*9 and configured to represent an incomplete Sudoku puzzle, find a solution that returns a true or false value depending on whether or not the Sudoku can be completed. If a solution is possible, your solution must also return the completed grid.
Problem Statement: Given the root node of a directed graph, clone this graph by creating its deep copy so that the cloned graph has the same vertices and edges as the original graph.
Problem Statement: Starting from the source node, traverse a given graph breadthwise to find the distance between the source node and node
Problem Statement: Given a graph
n*n with each cell containing a value of
3, return a
false value depending on whether or not one can find a path from the source node to the destination node. Each graph will have one source node and one destination node. The graph can be traversed horizontally and vertically.
The cell containing a value of
0 is the source node.
A value of
1 represents a wall; this node is impassable.
A value of
2 represents a blank cell that can be traversed.
A value of
3 represents the destination node.
Problem Statement: Given
n people on a square grid, find the point that requires the least total distance covered by all people to meet at that point.
Problem Statement: We are given a two-dimensional array where all elements in any individual row or column are sorted. In such a matrix, we have to search or find the position of a given key.
If you have over 3 years of experience developing software, it is highly likely that you will be asked system design questions, which can be more open-ended.
To get an idea of what to expect from a system design interview, check out the Top 10 system design interview questions for software engineers.
The timeline for the entire process (from submitting your resume to receiving a job offer) takes approximately 1-2 months You are encouraged to use whatever mainstream programming language (e.g., C/C++ or Java) that you are most comfortable with to solve the technical questions.
Microsoft develops a holistic view of you as a candidate using competency-based questioning in addition to your resume. They want candidates with strong technical skills that align well with the company values.
|Corporate Values||Microsoft Definition|
|Respect||“We recognize that the thoughts, feelings, and backgrounds of others are as important as our own.”|
|Integrity||“We are honest, ethical, and trustworthy.”|
|Accountability||“We accept full responsibilities for our decisions, actions, and results.”|
|Core Competencies||Microsoft Definition|
|Collaboration||“Communicating effectively within the team and across teams.”|
|Drive for Results||“Working tenaciously to deliver on commitments, constantly seeking bigger challenges, holding yourself and others accountable.”|
|Customer Focus||“Our missing at Microsoft is to empower every person and every organization to achieve more.”|
|Influencing for Impact||“Successfully persuading and influencing others with effective communication.”|
|Judgment||“Effectively scoping complex problems and using business acumen to make knowledge-based decisions.”|
|Adaptability||“Ability to deal with ambiguous and uncertain situations or problems with agility.”|
The first thing you want to do is to make sure your resume and LinkedIn profile are up to date. Be very specific, and use deliverables and metrics whenever possible.
Next, you’ll want to look at your resume in the context of the Microsoft Core Competencies. Consider how specific projects or experiences can be tied into different Core Competencies, and update them to reflect ways in which you have prioritized these values in your work.
To fully prepare yourself for the coding interview, we strongly suggest that you take three months to go over technical concepts and practice solving interview questions. Using an interview prep roadmap is a great way to keep track of your progress, and break down what you need to learn.
You can use our Definitive Interview Prep Roadmap to make sure you’re hitting all of the important topics that might be covered during coding interviews.
Behavioral interview questions typically fall into one of three categories:
Behavioral interviews help interviewers decide if you’re someone they would want to work with. Reflect on how you react to positive situations or conflicts in a professional setting, and be honest about your past experiences. Essentially, be your authentic self.
Don’t be afraid to bring your unique perspective to the table. Go beyond just answering questions. Really listen and respond to your interviewers. Show them that you’re engaged and tuned into the conversation you’re having with them.
The most important thing to keep in mind for any behavioral interview is that your interviewers want to hire you. If you’re enthusiastic about the technology you’ll be working with, don’t be afraid to show it!
If you want to brush up on behavioral interview questions, then check out Grokking the Behavioral Interview to learn more about what interviewers are looking for, and how you can develop the kind of structured responses that impress them.
You can also read up about the key attributes that define the culture at Microsoft.
Now that you’re more familiar with the Microsoft interview process, it’s time to make a plan and put it into action! The best candidates come fully prepared, so it’s important to exercise due diligence. We’ve put together an extensive course that will help you quickly identify any gaps in your knowledge, test your skills, and practice using a live, in-browser coding environment.
You can visit our Decode the Coding Interview library. The Decode series exposes you to some of the most frequently asked questions at tech companies and helps solidify your knowledge by contextualizing these problems in real-world applications.
Join a community of more than 1.4 million readers. A free, bi-monthly email with a roundup of Educative's top articles and coding tips.