Microsoft Coding Interview Questions
20 Microsoft coding interview problems with full optimal solutions — 5 easy, 13 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Microsoft interviewer values, and a FAQ section.
Showing 2 problems of 20
- #42hardfrequently asked
42. Trapping Rain Water
Trapping Rain Water is the Microsoft hard that separates the two-pointer fluent from the rest. Naive answer is O(n^2). DP with leftMax/rightMax arrays is O(n) time + O(n) space. The two-pointer version is O(n) time + O(1) space — the bonus the interviewer is hoping you reach.
4 free resourcesSolve → - #297hardfrequently asked
297. Serialize and Deserialize Binary Tree
Serialize and Deserialize Binary Tree is Microsoft's litmus test for whether you can design a custom encoding and parse it back. The pre-order DFS with explicit null markers is the standard answer; the interviewer is grading whether your serializer and deserializer agree on exactly how nulls are represented.
4 free resourcesSolve →
Related interview-prep guides
HireVue Tech Interview Guide: The 2026 Playbook for Async Video Rounds
HireVue is the category-leading async video interview platform. Candidates record answers solo, on the clock, and a combined AI-plus-human review layer scores the recording days later. For 2026 tech jobseekers, the format is different enough from live interviews to need its own playbook. This guide is that playbook.
Codility for Tech Interviews in 2026: The Complete Guide for Candidates
Codility is the dominant algorithmic-assessment platform across European tech hiring. Heavy in the UK, Germany, Netherlands, Nordics, and Poland where the company was founded. It scores candidates on both correctness and time complexity, runs 60-to-120-minute timed tests, and ships three products: Tests, CodeCheck, and CodeLive. This guide is what 2026 candidates need to know.
LeetCode Assessments: The 2026 Tech Interview Guide
LeetCode Assessments is the enterprise tier of the LeetCode platform: a separate product from the public site candidates know from grinding problems. Companies pay LeetCode to build custom timed assessments that draw from the 3,000-problem public catalog plus optional private variations, and the catalog asymmetry is the whole story for prep.