Microsoft Coding & Algorithms Interview Questions

Microsoft Coding & Algorithms interview questions are centered on algorithmic problem solving, clear coding, and the ability to reason about complexity under time pressure. At Microsoft you’ll typically be evaluated on problem decomposition, correctness, time/space complexity, edge-case handling, and communication: interviewers want to see that you can produce a correct solution, explain your approach, and iterate when given feedback. Expect online assessments and phone screens that use collaborative coding editors, followed by a loop of focused technical interviews that mix coding problems with occasional system or design-style questions depending on level. For effective interview preparation, prioritize pattern recognition and timed practice: master arrays and strings, trees and graphs, hashing, dynamic programming, and complexity analysis, and practice explaining tradeoffs aloud. Simulate the coding environment you’ll face, write and test complete solutions, and rehearse concise, structured explanations of your thought process. Balance breadth with depth so you can move quickly between easy and medium problems while still handling harder algorithmic puzzles when required.

100 Questions 1 Company08.03.2026
Showing 20 results
Role
Microsoft logo
Microsoft
Medium
Software Engineer

Minimize Fuel Cost Across Cities

Minimize Fuel Cost Across Cities Problem Hackerland has g_nodes cities numbered from 1 through g_nodes and bidirectional roads. Road i connects g_from...

Coding & Algorithms
0
0
11 people solved
Aug 3, 2026
Microsoft logo
Microsoft
Medium
Data Scientist

Compute the Product of an Array Except Self

The interview report preserved the input-output example but not every original restriction. The following is a self-contained version of the reported ...

Coding & Algorithms
8
1
60 people solved
May 4, 2026
Microsoft logo
Microsoft
Hard
Software Engineer Locked

Return Top K Open Businesses

This question evaluates a candidate's ability to perform filtering and multi-criteria ranking, requiring correct handling of an open-status filter and...

Coding & Algorithms
8
0
97 people solved
May 10, 2026
Microsoft logo
Microsoft
Easy
Software Engineer

Solve four classic algorithm problems

You are given four independent coding tasks. For each task, implement the required function. --- Problem 1: Zigzag level-order traversal of a binary t...

Coding & Algorithms
19
0
156 people solved
Nov 30, 2025
Microsoft logo
Microsoft
Medium
Machine Learning Engineer Locked

Implement SFT Sample Packing

This question evaluates proficiency in preprocessing for autoregressive language models, including deterministic sequence packing, construction of los...

Coding & Algorithms
4
0
49 people solved
Apr 13, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Identify the Extra Directed Edge

You are given a list of directed edges edges, where each edge is represented as [parent, child]. The graph contains nodes labeled from 1 to n, and it ...

Coding & Algorithms
4
0
58 people solved
Jan 3, 2026
Microsoft logo
Microsoft
Hard
Software EngineerSenior+

Implement concurrent structures and debug queue code

The coding rounds covered several implementation and debugging tasks: 1. Implement an LRU cache that supports get(key) and put(key, value) in constant...

Coding & Algorithms
5
0
41 people solved
Apr 7, 2026
Microsoft logo
Microsoft
Medium
Software EngineerSenior+

Minimum Moves on a Grid with k-Cell Jumps

You are given an m x n grid. Each cell is either open or blocked: - grid[i][j] = 0 means the cell is open. - grid[i][j] = 1 means the cell is blocked....

Coding & Algorithms
0
0
10 people solved
Jun 11, 2026
Microsoft logo
Microsoft
Easy
Software Engineer

Solve binary-tree reverse printing and LPS

You are given a binary tree node definition: - TreeNode { int val; TreeNode left; TreeNode right; } Answer the following two algorithmic questions. 1)...

Coding & Algorithms
11
0
125 people solved
Dec 24, 2025
Microsoft logo
Microsoft
Easy
Data ScientistNew Grad

Compute and plot a precision–recall curve

You are given model outputs for a binary classifier: - y_true: an array of 0/1 ground-truth labels of length n. - y_score: an array of predicted score...

Coding & Algorithms
6
0
66 people solved
Nov 24, 2025
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Implement a type-based mutex for tasks

This question evaluates understanding of concurrency and synchronization primitives, testing the ability to design a thread-safe type-based mutex that...

Coding & Algorithms
11
0
87 people solved
Mar 1, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

In-Memory URL Shortener: Encode and Decode

This question evaluates a candidate's ability to design a class-based data structure with paired encode and decode operations that maintain a consiste...

Coding & Algorithms
0
0
7 people solved
Jun 12, 2026
Microsoft logo
Microsoft
Hard
Software Engineer Locked

Decode a JWT string without libraries

This question evaluates understanding of JWT structure, Base64URL encoding, string manipulation, and JSON parsing as applied to decoding token compone...

Coding & Algorithms
1
0
33 people solved
Feb 11, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Stream output until stop token appears

This question evaluates streaming string processing and pattern-matching skills, specifically handling token detection across chunk boundaries, bounda...

Coding & Algorithms
14
0
149 people solved
Feb 12, 2026
Microsoft logo
Microsoft
Easy
Software Engineer

Implement interval room counter and token manager

You are given two coding questions. 1) Minimum number of rooms for time intervals You are given a list of meetings, where each meeting is an interval ...

Coding & Algorithms
185
3
2214 people solved
Feb 12, 2026
Microsoft logo
Microsoft
Hard
Software Engineer Locked

Find minimum cycle cost per node

This question evaluates proficiency in graph algorithms and algorithmic optimization, specifically reasoning about weighted directed graphs, cycle cos...

Coding & Algorithms
6
0
68 people solved
Feb 11, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Determine most popular concert city

Determine most popular concert city Given a set of concert venue vote records, determine which city is the most popular. How would you normalize city ...

Coding & Algorithms
3
0
57 people solved
Aug 4, 2025
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Solve Three Coding Interview Problems

This set of problems evaluates competency in algorithmic problem-solving, including merging sorted arrays with duplicate elimination, reasoning about ...

Coding & Algorithms
1
0
38 people solved
Feb 7, 2026
Microsoft logo
Microsoft
Medium
Machine Learning EngineerSenior+ Locked

Find Top K Largest Elements

This question evaluates a candidate's skill in algorithmic selection and data-structure usage for extracting top-k elements from large arrays, emphasi...

Coding & Algorithms
3
0
28 people solved
Feb 5, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Find the Best Connected Strength for Every Tree Node

Find the Best Connected Strength for Every Tree Node A tree contains n neurons. Each neuron is either strong or weak. Assign weight +1 to a strong neu...

Coding & Algorithms
1
0
15 people solved
May 20, 2026

Frequently Asked Questions

How difficult are Microsoft Coding & Algorithms interview questions?
Microsoft Coding & Algorithms questions typically span easy to hard difficulty, with most technical rounds focusing on medium-to-hard problems that test algorithmic thinking under time pressure. Interviewers expect clear reasoning, correct edge-case handling, and reasonably optimized solutions; for mid-level roles you’ll often see medium problems emphasizing arrays, strings, trees, and hashing, while senior candidates face harder dynamic programming, graph, and design-of-algorithm challenges. The difficulty also depends on role level and domain: applied research or specialized teams may ask deeper algorithmic proofs or complexity trade-offs. Expect to demonstrate both correctness and thoughtfulness about performance.
Where in the Microsoft interview process do Coding & Algorithms questions appear, and how is the process structured?
Coding & Algorithms questions appear throughout Microsoft’s screening pipeline: they commonly show up in the online assessment and technical phone screen, and they dominate multiple rounds of the onsite or virtual onsite loop. A typical structure begins with a recruiter screen, then an online coding assessment or technical phone interview that evaluates problem solving in a shared editor, followed by a series of one-hour interviews where 2–4 coding rounds are interleaved with design and behavioral conversations. For senior roles, expect algorithmic depth in coding rounds and algorithmic reasoning to surface during system or design discussions.
How long should I prepare for Microsoft Coding & Algorithms interviews — what timeline works best?
A practical preparation timeline is usually 6–12 weeks of focused practice for most mid‑level candidates, with adjustments based on background and target level. Start with a diagnostic week to identify weak areas, then spend 4–6 weeks building breadth across arrays, strings, trees, graphs, and DP, followed by 1–2 weeks of timed mock interviews and editor practice to simulate real sessions. If you’re aiming for senior roles, add several weeks for advanced algorithmic problems and technical communication drills. Consistent daily practice with explanation and review beats last‑minute cramming.
What key subtopics within Coding & Algorithms should I focus on for Microsoft interviews?
Concentrate on data structures and algorithmic patterns that Microsoft interviewers commonly evaluate: arrays and strings, two‑pointer and sliding window techniques, hash maps and sets, linked lists, recursion and trees (including traversals), graph traversal and shortest paths, heaps, sorting and binary search, and dynamic programming. Equally important are complexity analysis, handling NULLs and corner cases, and writing clean, testable code in a collaborative editor without IDE aids. Practicing problem classification and translating requirements into efficient data models will help you move from a correct solution to an optimal, interview‑ready answer.
What standout tips and common pitfalls should I know when preparing for Coding & Algorithms at Microsoft?
Standout tips include always clarifying requirements and constraints before coding, proposing multiple solutions with trade‑offs, and communicating your thought process clearly while writing concise, readable code. Practice in a plain collaborative editor to mimic interview conditions and time yourself on medium and hard problems. Common pitfalls are diving into implementation without confirming edge cases, failing to analyze time and space complexity, not testing with representative inputs, and overcomplicating solutions when a simpler approach suffices. Remember to verbalize assumptions and to iterate when you get feedback from the interviewer.

Explore more Microsoft Coding & Algorithms interview questions

Real questions from candidate reports, grouped by role, topic and company.

By role
Other categories at Microsoft
Coding & Algorithms questions at other companies
Browse all