Microsoft Coding Interview Questions
46 coding questions reported by candidates who interviewed at Microsoft, out of 61 Microsoft questions we track. They average 2.9/5 difficulty (medium). Most common topics: Array, Simulation, String, Hashmap. 24 were reported asked within the last year, most recently in August 2026.
Practice Microsoft questions →Difficulty
- 2/5 — easy14
- 3/5 — medium24
- 4/5 — hard6
- 5/5 — very hard2
Asked for SWE (44), MLE (4), Infra (2), DataEng (2)
Reported Microsoft coding questions
Count Occurrences of the Suffix Maximum for Each Query
2/5An array question about answering many lookups quickly: each lookup names a starting position and asks a frequency question about the largest value from there onward. With a hundred thousand lookups, rescanning is too slow, so it rewards a single backward pass and careful handling of negative numbers and ties.
asked August 2026ArrayPrefix SuffixPrecomputationDNA Shotgun Sequencing: Chain and Eulerian Path Reconstruction
5/5Tackle an advanced string reconstruction challenge inspired by biological sequencing workflows, frequently utilized in top-tier technical interviews at Microsoft. This problem requires stitching together fragmented sequence data by leveraging overlapping tags and graph traversal techniques across escalating levels of complexity. You will be tested on your ability to model relationships as paths and manipulate sequence payloads efficiently. View the complete problem statement and optimal algorithmic solution by obtaining a subscription.
asked May 2026GraphEulerian PathDFSIn-Memory SQL Engine with CSV Parser
4/5Featured in Microsoft interviews, this advanced coding challenge asks you to build a lightweight in-memory database engine complete with a custom CSV parsing mechanism from scratch. You will handle complex data ingestion challenges including quoted strings and escaped characters, followed by implementing foundational query operations like filtering and sorting. This comprehensive task tests your parser design capabilities and data manipulation logic under strict constraints. Gain access to the full problem description and the model solution with a subscription.
asked May 2026ParsingState MachineIn Memory DatabaseOrg Chart Subtree Report Count with Incremental Updates
3/5This Microsoft interview question assesses your proficiency in tree data structures, hierarchical aggregations, and dynamic graph mutations under read-heavy workloads. Candidates are required to design a system that efficiently computes total subtree reporting counts while supporting frequent organizational updates like employee reassignments and managerial changes. The problem tests advanced caching, traversal strategies, and incremental maintenance of aggregate states. Unlock the full problem description, algorithmic paradigms, and complete model solution with a subscription.
asked May 2026TreeSubtree AggregationData StructureContiguous Memory Allocator
3/5This Microsoft interview problem challenges you to design and manage a fixed-size memory reservation system with custom assignment and release behaviors. You will explore core systems concepts such as fragmentation management, block merging, and strategy tradeoffs like first-fit versus buddy allocation algorithms. The exercise evaluates your ability to write robust low-level resource handlers and defend your architectural choices. Unlock the full challenge details and comprehensive model solution with a subscription.
asked May 2026Linked ListSimulationMemory AllocationTop-K Largest Elements (Retain / Rank Stores)
2/5This popular phone-screen warm-up, frequently reported during interviews at Microsoft, evaluates your ability to filter and rank elements from a collection under specific ordering constraints. Candidates must design an efficient approach to isolate top-tier items while preserving sequence integrity or applying complex business rules. The full problem statement, test cases, and model solution require a subscription.
asked May 2026HeapTop KSortingLRU Cache (LC 146) + Multithreading Variant
3/5As one of the most frequently asked problems at Microsoft, this challenge requires building a bounded-capacity cache with constant-time lookup and eviction capabilities, often extended with concurrency controls. It tests your mastery of hybrid data structures, pointer manipulation, and thread-safe synchronization primitives in multi-threaded environments. You will need to design an efficient architecture that handles concurrent read and write operations without performance degradation. Unlocking the complete problem description and model solution requires a subscription.
asked April 2026Linked ListHashmapData StructureSliding-Window Stream Session Bucketing
2/5Explore this stream processing challenge recently asked in Microsoft technical screens, focusing on chronological data aggregation. The task involves grouping continuous timestamped events into fixed-width time intervals and extracting the boundary values for each populated segment in a single linear pass. This exercise assesses your data stream handling and algorithmic efficiency. Unlocking the complete problem specification and reference code requires a subscription.
asked April 2026HashmapStreamingSliding WindowIn-Place Sub-Matrix Move with Overlap
3/5Reported from a Microsoft interview, this advanced matrix manipulation challenge requires relocating a smaller sub-grid within a larger two-dimensional array entirely in-place. The primary hurdle is managing source and destination region overlaps correctly without overwriting unread data during the shift, while also clearing out abandoned cells. It tests your spatial reasoning, index manipulation, and ability to handle complex boundary conditions without allocating auxiliary memory grids. The complete problem statement and optimized model solution require a subscription.
asked April 2026MatrixIn PlaceSimulationCount Positive Pairs with 1/x + 1/y = 1/N
3/5This reported Microsoft interview challenge requires finding the quantity of valid integer pairs that satisfy a specific reciprocal equation involving a given constant. Because the parameter can be quite large, a brute-force enumeration will exceed time limits, testing your ability to apply mathematical transformations and algebraic reduction for efficient computation. You will need to optimize the search space to achieve sub-second execution. To explore the complete problem statement and review the optimal model solution, a paid subscription is required.
asked March 2026MathNumber TheoryDivisor CountBalanced Permutation Prefix Check
3/5In this Microsoft interview puzzle, you will analyze permutations to locate contiguous subsegments that contain consecutive integer ranges starting from one. For every possible subset size up to the sequence length, your goal is to determine if a valid matching window exists and compile the findings into a binary result string. This challenge measures your proficiency with range queries, multiset properties, and clever array traversal strategies. To view the full problem statement and professional model solution, subscribe today.
asked March 2026ArrayGreedyPermutationIn-Memory KV Store with Snapshot Versions
5/5Build a high-performance in-memory key-value data structure supporting instant point-in-time snapshots, as featured in advanced Microsoft coding assessments. This rigorous puzzle evaluates your capacity to manage historical mutations efficiently without resorting to expensive full-state duplication while guaranteeing safe deletion semantics. Unlock the complete technical specifications and optimal solution by upgrading your account.
asked March 2026MVCCSnapshotVersioningResumable Batch Dataloader with Weighted Sampling
4/5Reported as a Microsoft engineering interview question, this advanced problem asks you to build a unified data loader that pulls weighted batches from multiple iterable sources while supporting complete checkpointing and state restoration. You will need to implement proportional sampling logic alongside robust serialization methods to pause and resume iteration seamlessly. This challenge tests your mastery of custom iterator design, state management, and architectural patterns for data pipelines. The full problem specification and production-grade model solution require a subscription.
asked March 2026IteratorCheckpointingSamplingBeam Search Decoder Implementation
4/5This sophisticated text generation challenge, frequently reported from interviews at Microsoft, dives into the core mechanics of probabilistic language model decoding. You are tasked with managing state and probability scores to extract sequences using both straightforward selection methods and multi-path exploration heuristics. The assessment focuses on your capability to handle specialized data structures, track cumulative weights, and efficiently maintain top candidates during iterative prediction steps. Discover the complete problem breakdown, underlying mathematical concepts, and a production-grade model solution with our subscription.
asked March 2026Beam SearchHeapDecodingStreaming Stop-Token Detection Across Chunk Boundaries
4/5Solve a challenging streaming text processing problem often featured in Microsoft engineering interviews, where you must detect multi-character stop tokens across arbitrary chunk boundaries without losing partial matches. This task evaluates your mastery over stateful stream parsers, buffer management, and edge-case handling in data pipelines. Honing your ability to process continuous data streams efficiently will significantly boost your systems programming capabilities. Unlocking the complete problem details and the verified model solution requires a paid subscription.
asked March 2026StreamingAho CorasickKmpGen/Score Task Lock Scheduler
4/5This Microsoft concurrency question asks you to write a per-key dependency gate for a worker pool: one kind of job must not begin until the producing jobs that share its key are done, while unrelated keys keep running in parallel. It tests condition variables, fine-grained locking and missed-wake-up bugs. Subscribe for the formal statement and the tested reference code.
asked February 2026ConcurrencyCondition VariableSynchronizationHand-Written K-Means
3/5Frequently asked during Microsoft screening rounds, this programming challenge requires candidates to build the unsupervised clustering algorithm completely from scratch using standard Python libraries or numerical computing frameworks. You will need to implement iterative centroid updates and cluster assignment logic while demonstrating a strong grasp of underlying operational complexities. Preparing for this exercise ensures you can articulate foundational machine learning concepts fluidly during live technical evaluations. Access the complete breakdown and verified implementation by purchasing a subscription.
asked February 2026ML KnowledgeNumPyPyTorchMultiply Strings (LC 43)
3/5Frequently asked during Microsoft software engineering interviews, this classic coding problem requires you to calculate the product of two large numerical values represented as strings without relying on native numeric casting or built-in arbitrary-precision arithmetic libraries. This exercise assesses your ability to simulate manual mathematical multiplication algorithms while carefully handling edge cases and string manipulation. Gain full access to the comprehensive problem guide and verified solution by getting a subscription.
asked February 2026StringMathBig IntegerParse Email Addresses from a Log String
4/5In this challenging Microsoft interview question, you must extract valid contact addresses from a messy, delimiter-separated text log. The task requires handling complex formatting anomalies such as embedded comments, alternative display names, and nested quotation marks that complicate standard parsing logic. This exercise assesses advanced string manipulation and regex-handling proficiency. View the entire problem statement and expert-crafted model solution with a paid subscription.
asked February 2026StringParsingState MachineIdempotency API with Idempotency-Key Header
3/5A Microsoft backend interview question on safe retries: design the server-side logic that lets clients resend a request without the operation running twice. You must remember earlier outcomes for a limited time, reject a reused token that arrives with a different payload, and coordinate simultaneous duplicates so only one of them does the work. It tests API design, hashing and synchronization skills. The full specification and a reference implementation are available with a subscription.
asked January 2026IdempotencyConcurrencyHashmapPalindrome Number Check and Next-Greater Palindrome
3/5This Microsoft interview question evaluates your ability to manipulate numerical digits directly without relying on string conversions. The challenge is divided into two distinct objectives: first, verifying whether a given integer reads identically in reverse, and second, discovering the minimal symmetric numerical value that strictly exceeds the input. It tests your mathematical reasoning, edge-case management for negative numbers, and algorithmic efficiency. Access to the complete problem breakdown and the optimal reference solution requires a subscription.
asked January 2026MathString ProcessingPalindromeDistance from Each Node to the Cycle
3/5Reported as an interview question at Microsoft, this graph theory challenge requires candidates to analyze network structures containing a single cyclic component with attached tree branches. The objective is to compute the shortest path from every vertex in the graph to the nearest node residing on the primary cycle. This problem evaluates graph traversal techniques and iterative node reduction strategies. Unlock the complete problem details and the optimal model solution by acquiring a paid subscription.
asked January 2026BFSGraphTopological SortSort Distinct Integers 0..32000 with a Bit Vector
2/5This classic Microsoft coding challenge requires sorting a large sequence of distinct integers confined to a narrow numerical range while operating under stringent memory limitations. The task tests your understanding of bitwise operations and efficient memory mapping to bypass traditional sorting overhead. To view the complete problem details and optimal implementation strategy, a subscription is required.
asked November 2025Bit ManipulationSortingIOValidate Lat/Long With Minimum Expensive API Calls
3/5This Microsoft interview puzzle requires verifying millions of geographical records while strictly minimizing external paid service queries. It tests advanced optimization, deduplication, and batch processing techniques to manage resource constraints efficiently. Access the full problem description and comprehensive solution by subscribing today.
asked November 2025Algorithm DesignDedupBatching15-Puzzle Minimum Moves (BFS)
3/5Reported as a Microsoft interview problem, this challenge requires you to compute the shortest path to solve a classic sliding tile puzzle board. The core task evaluates your graph traversal skills, specifically utilizing state-space search algorithms to determine the minimum number of transitions needed to reach the target configuration. You must also account for solvability constraints and handle state space explosions efficiently. Get full access to the problem details and optimal code implementation with a subscription.
BFSGraphState SpaceFind Fair Indexes
3/5Find every split point that cuts two equal-length arrays into halves whose four sums all come out the same. Asked at Microsoft, this is a prefix-sum question with a neat observation up front: both arrays must have the same total and that total must be even, or no split point can exist at all. You will precompute running sums, test each candidate in constant time, and handle negative values that break any monotonic assumption. The full problem and the reference solution require a subscription.
ArraysPrefix SumPartitionImplement Queue using Stacks (Round 2, LC 232:)
2/5Build a first-in-first-out structure using nothing but two last-in-first-out ones, supporting push, peek, removal, and an emptiness check. This Microsoft new-grad round is a classic because of its amortised analysis: moving elements between the two stacks only when one runs dry keeps the average cost constant even though a single operation can be linear. You will decide when to transfer and be ready to justify the amortised bound. The full problem and the model implementation are available to subscribers.
StackQueueDesignCheck Path Presence
3/5Check whether an undirected graph lets you walk from the first vertex to the last by visiting the vertices in strictly increasing numeric order. Asked at Microsoft, this is deliberately not a reachability question: the route is fixed in advance, so the only thing to verify is that every consecutive pair is directly connected. You will build a fast edge lookup, scan the required sequence once, and handle duplicate or self edges without confusion. The full problem and the reference solution are available with a subscription.
GraphPathArraysFind Suitable Locations
3/5A Microsoft grid question: given a map of empty lots and homes, count the lots from which a new shop would be near enough to every single home. A direct approach measures each lot against each home; the efficient one notices that only a few extreme homes matter. You will reason about grid-step distance, handle maps with no homes, and aim for one pass over the grid. Subscribe for the full statement and the reference solution.
GraphBFSMatrixMerge Two Sorted Arrays and Deduplicate
2/5Combine two already-sorted arrays into one sorted result with every repeated value appearing only once, without disturbing either input. This Microsoft question is the merge step of merge sort with a deduplication rule layered on, and the rule applies across both inputs rather than within each. You will advance two cursors, skip values equal to the last one emitted, and handle an empty input on either side. The complete problem and the reference solution are available with a subscription.
ArrayTwo PointersSortingPossible Bipartition Variation
3/5Decide whether a group of people can be split in two so that no pair who refuse to be together ends up on the same side. Asked at Microsoft, this is a two-colouring question on the conflict graph, and the detail that trips people is that the graph can be disconnected, so every component needs its own search. You will colour as you traverse, detect the odd cycle that makes a split impossible, and handle people with no conflicts at all. The full problem and the reference solution require a subscription.
GraphBipartiteDFSPython Data Processing Question
2/5Take a list of employee records and report the mean age within each department of the company. This Microsoft question is routine aggregation, and the marks go to the parts around it: the signature you choose, the tests you write, and a word about how the approach behaves as the record count grows. You will accumulate totals and counts together, decide what an absent or malformed field does, and keep the result stable. The complete problem and the reference solution are available to subscribers.
PythonDictionaryAggregationStr with Longest Len
3/5Find the longest piece of text that is both a leading and a trailing part of a string without being the whole of it. Asked at Microsoft, this is the classic prefix-function problem: the naive comparison of every candidate length is quadratic, while the failure table from string matching answers it in one pass. You will build that table, read the answer off its last entry, and handle a string with no such overlap at all. Subscribers get the complete problem and the model solution.
StringPrefixSuffixSplit String by Spaces Unless '*' Appears
2/5Split a string on whitespace, unless it contains a particular marker character, in which case split on that marker instead and keep the spaces. This Microsoft question is a specification-following exercise where the two modes behave differently on purpose, and consecutive separators are discarded in both. You will detect the mode first, avoid emitting empty pieces, and handle a string made entirely of separators. The full problem and the reference solution require a subscription.
StringParsingSimulationRotate String (variant with two string arrays)
3/5Decide whether every string in one list can be rotated to match the corresponding string in another. Asked at Microsoft, the clean test is that a rotation of a word appears inside that word doubled, which turns each comparison into one substring search instead of trying every shift. You will check lengths and character counts first as a cheap filter, and keep the total work linear in the combined input size. A subscription unlocks the full problem and the model solution.
StringsArrayRotationSimple Data Processing Task
2/5Read a line of integers from standard input and print their average as a floating-point value, without reaching for a numeric library. This Microsoft warm-up exists to check input handling: any count of values must work, and the division has to produce a real quotient rather than a truncated one. You will parse defensively, decide what an empty line should do, and keep the output format stable. A subscription unlocks the full problem and the reference program.
String ParsingArraysMathCleaning Robot
3/5Simulate a cleaner that drives straight until something blocks it, turns in place, and continues, then report how much of the floor it covered. This Microsoft question is a careful simulation: the turning rule, the stopping condition, and the treatment of already-visited squares all have to match the specification exactly. You will track position and heading, detect the state where no further progress is possible, and count visited squares once each. Subscribers get the complete problem and the model solution.
SimulationGridArraysValid Mixed Case Letters
2/5Count the letters of a string that appear in both cases, with every lowercase occurrence positioned ahead of every uppercase one. This Microsoft question is a counting exercise with an ordering condition, and the condition is what makes a single pass interesting: you need the last lowercase position and the first uppercase position per letter. You will compare those positions per letter, require both cases to be present, and ignore letters that appear in only one case. A subscription unlocks the full problem and the model solution.
StringHashmapCountingGet Most Active Users Within Time Range
3/5Work out which users were online the longest inside a time range, given unordered connect and disconnect events. This Microsoft question is an interval-reconstruction problem: the events must be paired per user, clipped to the window, and then totalled before any ranking happens. You will sort per user, handle a session that starts before the window or never closes, and return the requested number of users in descending order. The complete problem and the model solution are available with a subscription.
ArrayIntervalsSortingReplace Digit
3/5Raise a long number as high as possible by replacing exactly a given number of its digits with a fixed larger digit. This Microsoft question is greedy with a catch in the wording: the move count is exact rather than a maximum, so you may be forced to spend changes that do not help. You will replace the leftmost improvable digits first, work out what to do when changes remain, and avoid touching digits that already match. A subscription unlocks the complete problem and the model solution.
GreedyStringSimulationInvert Binary Tree
2/5Mirror a binary tree so that every node's children swap sides, and return the same root. This Microsoft warm-up is three lines recursively and is asked to check that you recurse before or after the swap consistently, and that you handle a missing child without a special case. You will choose between recursion and an explicit queue, note the depth cost of each, and confirm the tree is modified rather than copied. A subscription unlocks the complete problem and the reference solution.
TreeBinary TreeDFSMin Num Letters
2/5Find the fewest letters to delete from a word so that what remains is in alphabetical order. This Microsoft question is the longest-non-decreasing-subsequence problem turned inside out: the answer is the word length minus that subsequence's length. You will choose between the quadratic table and the patience-sorting approach with binary search, and handle repeated letters without accidentally requiring strict increase. The complete problem and the reference solution are available to subscribers.
StringGreedyDynamic ProgrammingImplement Queue using Stacks
2/5Expose first-in-first-out behaviour using two last-in-first-out containers and nothing else, covering insertion, inspection, removal, and emptiness. This Microsoft new-grad round rewards the amortised design over the naive one: transferring elements only when the outbound container empties keeps the average cost constant. You will say why a single operation can still be linear, and handle inspection on an empty queue. Subscribers can read the complete problem and the reference implementation.
StackQueueDesignMaximum Number of Moves with Same Result
3/5Count the most moves you can make on an array when each move removes two elements from the ends or the front, and every move must produce the same total. This Microsoft question becomes tractable once you notice there are only three candidate totals to try, each determined by the first move. You will simulate each candidate with two pointers, count the moves it sustains, and take the best of the three. The full problem and the reference solution require a subscription.
ArrayPrefix SumSubarrayMinimum Domino Removals
3/5Work out the fewest tiles to discard from a line of two-sided tiles so that the rest can form a valid chain. This Microsoft question hides a counting argument behind the physical setup: what survives depends on how often each face value appears, so the answer follows from the frequency table rather than from simulating arrangements. You will build that table, reason about which values can anchor a chain, and handle tiles whose two faces match. Subscribers can read the full problem and the model solution.
ArrayGreedyCountingRemove Duplicate Letters Preserving First Occurrence Order
2/5Strip the repeated letters out of a string so that each surviving letter sits where it first appeared. This Microsoft warm-up is a single pass with a seen-set, and the ordering requirement is what rules out sorting or using a plain set as the output. You will emit on first sight only, keep the original order intact, and handle a string whose letters are all distinct. A subscription unlocks the full problem and the reference solution.
StringHashmapArray
Recent Microsoft interview experiences
Full loops shared by candidates, every round included.
Microsoft coding interview FAQ
- What coding questions does Microsoft ask?
- 46 reported coding questions, most often on Array, Simulation, String, Hashmap, Graph.
- How hard is the Microsoft coding interview?
- The reported coding questions average 2.9 out of 5: 14 at 2/5, 24 at 3/5, 6 at 4/5, 2 at 5/5.
- Are these Microsoft coding questions recent?
- The most recent report is from August 2026, and 24 were reported within the last twelve months. Dates come from the interview reports themselves.