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
Machine Learning EngineerIntern

Find pairs with the minimum absolute difference

Given an integer array (not necessarily sorted), find the minimum absolute difference between any two distinct elements. Return all pairs of values th...

Coding & Algorithms
4
0
73 people solved
Feb 9, 2026
Microsoft logo
Microsoft
Medium
Machine Learning Engineer Locked

Implement K-means clustering from scratch

This question evaluates competency in clustering algorithms, numerical computation, and practical algorithm implementation, focusing on core K-means c...

Coding & Algorithms
3
0
50 people solved
Feb 9, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Populate next pointers in a perfect binary tree

You are given a perfect binary tree (all leaves at the same level; every internal node has two children). Each node has fields left, right, and next. ...

Coding & Algorithms
7
0
78 people solved
Feb 7, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Design a Versioned Key-Value Store

This question evaluates understanding of time-versioned data structures, temporal indexing, and efficient lookup strategies for storing and retrieving...

Coding & Algorithms
2
0
36 people solved
Jan 26, 2026
Microsoft logo
Microsoft
Hard
Software Engineer Locked

Return a topological ordering of a graph

This question evaluates understanding of graph algorithms—particularly topological sorting and cycle detection—and competency in ordering dependencies...

Coding & Algorithms
4
0
73 people solved
Jan 22, 2026
Microsoft logo
Microsoft
Hard
Software Engineer Locked

Group GPUs by node and partition by links

This question evaluates understanding of graph algorithms and combinatorial optimization, specifically skills in graph traversal, grouping by node att...

Coding & Algorithms
12
0
87 people solved
Jan 22, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Implement a rate limiter at scale

This question evaluates understanding of algorithmic and system-level design for per-key rate limiting, including data structures, time/space complexi...

Coding & Algorithms
7
0
82 people solved
Jan 22, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Count non-decreasing arrays by digit sums

You are given an array required_sums of length n. Count how many non-decreasing arrays result[1..n] of integers satisfy all of the following: ( 1) for...

Coding & Algorithms
5
0
62 people solved
Sep 6, 2025
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Compute shortest path in cyclic graph

This question evaluates understanding of graph algorithms and shortest-path computation in weighted directed graphs, including handling cycles, non-ne...

Coding & Algorithms
2
0
48 people solved
Jan 3, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Implement a generic tree Node class

Design and implement a Node class for a mutable rooted tree. Requirements: store value, parent, and ordered children; support add_child, remove, move_...

Coding & Algorithms
9
0
70 people solved
Aug 14, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Determine dictionary-based string segmentation

You are given a string s and a set of tokens dict. Determine whether s can be segmented into a sequence of one or more tokens from dict. If segmentati...

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

Implement a calendar with non-overlapping bookings

Problem Design a calendar booking system that stores half-open time intervals [start, end) (inclusive of start, exclusive of end). Implement a class w...

Coding & Algorithms
12
1
89 people solved
Nov 25, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Merge overlapping intervals

You are given an array of intervals, where each interval is represented as a pair of integers [start, end] with start <= end. The intervals may be uns...

Coding & Algorithms
3
0
55 people solved
Nov 19, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Find max consecutive elements with sum below target

You are given: - An integer array nums of length n, sorted in non-decreasing order. - An integer index such that 0 ≤ index < n. - An integer target. S...

Coding & Algorithms
8
0
84 people solved
Nov 17, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Build a time-based key-value store

Problem Design a data structure that stores multiple values for the same key at different timestamps, and can retrieve the most recent value as of a g...

Coding & Algorithms
7
0
70 people solved
Oct 14, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Implement a Tic-Tac-Toe game class

Problem Implement a class that supports playing an n × n Tic-Tac-Toe game. Requirements Create a class TicTacToe(n) with: - move(row, col, player) -> ...

Coding & Algorithms
6
0
68 people solved
Oct 14, 2025
Microsoft logo
Microsoft
Medium
Data Scientist

Solve two-pointer, sliding-window, and string tasks

Solve the following three coding tasks: 1) Two-pointer in-place de-duplication: Given a non-decreasing integer array nums and an integer k >= 1, modif...

Coding & Algorithms
6
0
46 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Medium
Data Scientist

Implement rotated array binary search with duplicates

Given an integer array nums that is a non-decreasing array rotated an unknown number of times. Duplicates may exist. Implement a function that returns...

Coding & Algorithms
5
0
67 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Compute sum of longest positive subarray

Compute sum of longest positive subarray Given an integer array that may contain positive and negative numbers, find the sum of the longest contiguous...

Coding & Algorithms
6
0
47 people solved
Jul 16, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Maximize a Product After a Shared XOR

Maximize a Product After a Shared XOR Given positive integers a and b and a bit width n, choose an integer x with 0 <= x < 2**n that maximizes: `text ...

Coding & Algorithms
1
0
11 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