Microsoft Math Coding Interview Questions
77 math coding problems are tagged as asked at Microsoft in interviews and online assessments reported by candidates. By difficulty they split into 25 basic, 38 intermediate and 14 advanced. The topics they most often combine with are String, Array, Number Theory, Counting.
Reported questions change over time and are not a guarantee of what you will be asked, so use the list to see which patterns Microsoft tends to test. For each problem, practise explaining your approach, its time and space cost and the edge cases before you write the code; every problem opens in an editor that runs your code against test cases.
Coding problems
- Valid Palindrome (Basic)
- Decode Ways (Intermediate)
- Power of Two (Basic)
- Happy Number (Intermediate)
- Count and Say (Intermediate)
- Integer to Roman (Intermediate)
- Power of Three (Basic)
- Count Primes (Intermediate)
- Power of Four (Basic)
- Coin Change Ways (Advanced)
- Target Sum (Advanced)
- Reverse Integer (Intermediate)
- Plus One (Basic)
- Ugly Number (Basic)
- Nim Game (Basic)
- Greatest Common Divisor of Strings (Intermediate)
- Maximum 69 Number (Basic)
- Sum of Subarray Minimums (Advanced)
- Number of Steps to Reduce to Zero (Basic)
- Remove K Digits to Get the Smallest Number (Intermediate)
- Count Numbers With Even Digits (Basic)
- Minimum Knight Moves (Intermediate)
- Count Numbers With Unique Digits (Intermediate)
- Coin Change Ways (Intermediate)
- Number of Digit One (Advanced)
- Sum of Subarray Minimums (Advanced)
- Median of Sliding Windows (Intermediate)
- Minimum Number of Perfect Squares (Intermediate)
- Sum of Root-to-Leaf Binary Numbers (Basic)
- Open the Lock (Intermediate)
- Combination Sum IV (Intermediate)
- Integer Break (Basic)
- Count Number of Texts (Intermediate)
- Count Ways to Build Good Strings (Intermediate)
- Number of Increasing Paths in a Grid (Advanced)
- Valid Number (Advanced)
- String to Integer (Intermediate)
- Integer to English Words (Advanced)
- Validate IP Address (Intermediate)
- Sum of Subarray Ranges (Intermediate)
- Ugly Number II (Intermediate)
- Super Ugly Number (Intermediate)
- Valid Sudoku (Intermediate)
- Smallest Divisor Given a Threshold (Intermediate)
- Median of Two Sorted Arrays (Advanced)
- Divide Two Integers (Intermediate)
- Perfect Number (Basic)
- Self Dividing Numbers (Basic)
- Nth Digit (Intermediate)
- Water and Jug Problem (Intermediate)
- Bulb Switcher (Intermediate)
- Mirror Reflection (Intermediate)
- Combination Sum III (Intermediate)
- Sudoku Solver (Advanced)
- Letter Combinations of a Phone Number (Intermediate)
- Restore IP Addresses (Intermediate)
- Letter Case Permutation (Basic)
- Second Largest Digit in a String (Basic)
- Stone Game IV (Intermediate)
- K Inverse Pairs Array (Advanced)
- Count the Number of Ideal Arrays (Advanced)
- Painting a Grid With Three Different Colors (Advanced)
- Divisor Game (Basic)
- Sorting the Sentence (Basic)
- Remove Digit to Maximize Result (Basic)
- Strong Password Checker (Advanced)
- Day of the Week (Basic)
- Largest Time for Given Digits (Basic)
- Strong Password Checker II (Basic)
- Matrix Diagonal Sum (Basic)
- Clumsy Factorial (Intermediate)
- Broken Calculator (Intermediate)
- Largest Palindromic Number (Intermediate)
- Add Digits (Basic)
- Three Divisors (Basic)
- Closest Prime Numbers in Range (Intermediate)
- Running Median of Stream (Intermediate)
Related
- Microsoft coding interview questions
- Math problems
- Microsoft basic problems
- Microsoft intermediate problems
- Microsoft advanced problems
- Company interview roadmaps
- All interview guides
Frequently asked questions
How should I use the Microsoft problem list?
Start with the basic problems, then the intermediate and advanced ones, and note which topics repeat. Solve each under a timer, then read the explanation.
Are these the exact Microsoft interview questions?
They are problems candidates reported being asked. Companies rotate questions, so use them to learn the patterns, not to predict the exact question.