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
Hard
Software Engineer Locked

Extract stream prefix before stop token

This question evaluates streaming string processing, incremental substring detection across chunk boundaries, and memory-efficient algorithm design fo...

Coding & Algorithms
3
0
62 people solved
Feb 1, 2026
Microsoft logo
Microsoft
Medium
Software EngineerNew Grad Locked

Build a CSV Query Engine

This question evaluates proficiency in text parsing, data modeling, and implementing in-memory query semantics, including CSV parsing rules, type infe...

Coding & Algorithms
5
0
41 people solved
Jan 31, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Compute distance of each node to a cycle

This question evaluates proficiency in graph algorithms, including understanding unicyclic graph structure, cycle identification, and computing minimu...

Coding & Algorithms
4
0
85 people solved
Jan 9, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Validate a JSON-like string

This question evaluates parsing and string-processing skills, focusing on structural validation of JSON-like text including matching and nesting of br...

Coding & Algorithms
10
0
134 people solved
Jan 6, 2026
Microsoft logo
Microsoft
Medium
Software Engineer Locked

Check palindrome and find next larger palindrome

This question evaluates proficiency in string and numeric manipulation, specifically palindrome detection and generation of the next strictly larger n...

Coding & Algorithms
4
0
44 people solved
Jan 3, 2026
Microsoft logo
Microsoft
Medium
Software Engineer

Assemble DNA payload strings from tagged fragments

You are given a list of DNA-like fragments. Each fragment is a tuple: - start_tag: string - end_tag: string - payload: string A valid DNA chain is for...

Coding & Algorithms
14
0
224 people solved
Dec 15, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Find longest substring without repeating characters

Problem Given a string s, return the length of the longest contiguous substring that contains no repeated characters. Input - s: a string (may contain...

Coding & Algorithms
3
0
65 people solved
Nov 25, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Find lowest common ancestor in tree

You are given the root of a binary search tree (BST) and two distinct nodes p and q that are guaranteed to exist in the tree. Task (BST case): - Find ...

Coding & Algorithms
6
0
56 people solved
Nov 19, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Count integer pairs satisfying 1/x + 1/y = 1/N

You are given a positive integer N (\(1 \le N \le 10^6\)). Consider the Diophantine equation: \[ \frac{1}{x} + \frac{1}{y} = \frac{1}{N}, \] where x a...

Coding & Algorithms
6
0
56 people solved
Nov 17, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Find shortest substring with n unique letters

Problem You are given a string s consisting of lowercase English letters and an integer n (1 ≤ n ≤ 26). Find the length of the shortest contiguous sub...

Coding & Algorithms
5
0
46 people solved
Nov 3, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Merge multiple sorted arrays using min-heap

Problem You are given k sorted arrays of integers: - arrays[0], arrays[1], ..., arrays[k-1] - Each arrays[i] is sorted in non-decreasing order. - The ...

Coding & Algorithms
4
0
51 people solved
Oct 28, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Reverse linked list in fixed-size groups

Problem You are given the head of a singly linked list and an integer k (k >= 1). Reverse the nodes of the list in-place in groups of size k: - The no...

Coding & Algorithms
4
0
58 people solved
Oct 28, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Design cache with least-recently-used eviction

You are asked to design an in-memory key–value cache that supports a least-recently-used (LRU) eviction policy. The cache must support the following o...

Coding & Algorithms
3
0
38 people solved
Oct 14, 2025
Microsoft logo
Microsoft
Hard
Data Scientist

Implement lower_bound on unknown-size sorted array

Lower Bound in Unknown-Length Nondecreasing Array via API Setup You are given a non-decreasing integer array A of unknown length n. You cannot access ...

Coding & Algorithms
3
0
52 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Easy
Data Scientist

Reverse a list in-place

Coding Task: Reverse a List In-Place (Python) Context You're implementing a utility function during a technical screen. The function must reverse a Py...

Coding & Algorithms
11
0
94 people solved
Oct 13, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Solve load balancing and perfect pairs

1) Contiguous load balancing: You have n identical resources (servers) and m ordered tasks with processing times burstTime[0..m-1]. Each server must b...

Coding & Algorithms
10
0
72 people solved
Sep 6, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Count k for consecutive-sum generator

An array generator service produces a consecutive-integers array starting at a positive integer k: [k, k+1, ..., k+m−1] for some m ≥ 1. The service re...

Coding & Algorithms
13
0
93 people solved
Sep 6, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Maximize profit with bounded sell window

Given an array prices[0..n-1] of daily stock prices and an integer D ≥ 1, you may perform at most one transaction (buy then sell). The sell day j must...

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

Solve binary-search knapsack & graph shortest path

Question Given a sorted list of items, design an efficient solution (using binary search) to achieve the target objective instead of a dynamic-program...

Coding & Algorithms
5
0
59 people solved
Aug 4, 2025
Microsoft logo
Microsoft
Medium
Software Engineer

Solve budget queries and shortest path

1) Budgeted purchases with sorted array: You are given an array prices of n positive integers and q budget queries. For each budget B, you may buy ite...

Coding & Algorithms
2
0
49 people solved
Aug 1, 2025

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