Microsoft Coding Interview Questions: 190 Tagged Problems
190 coding problems tagged Microsoft — 45 easy · 90 medium · 55 hard — with solutions in 13 languages. Plus a 4-week study plan by topic.
- Problems: 190
- By difficulty: 45 easy · 90 medium · 55 hard
- Languages: JavaScript, TypeScript, Python, Java, C++, C, C#, Go, Kotlin, Swift, Rust, PHP and Ruby
- Cost: Free on every plan; sign in to run and submit
190 problems the CodeKairo catalogue tags as commonly asked in Microsoft's coding rounds — 45 easy, 90 medium and 55 hard — each judged by hidden tests in 13 languages. The most common topics among them are Arrays (119), Dynamic Programming (47) and Strings (44). CodeKairo's Microsoft — Online Assessment mock covers the Microsoft online assessment pattern: two coding problems on a platform such as Codility or HackerRank, and nothing that is not code. The tag is the catalogue's own annotation of where a problem tends to come up — not a list published by Microsoft, which CodeKairo is not affiliated with.
Microsoft study plan by topic
40 of the 190 problems tagged Microsoft over 4 weeks, about 21 h 5 min of solving, grouped by technique in the order they build on each other — Strings, Hash Table, Counting and Math and 24 more. It ends with the Microsoft — Online Assessment mock.
Week 1: Strings, Hash Table, Counting +5
12 problems on Strings, Hash Table, Counting, Math, Two Pointers, Sliding Window, Prefix Sum and Sorting, easiest first within each topic.
- Length of Last Word Easy
- Roman to Integer Easy
- Maximum Count of Positive Integer and Negative Integer Easy
- Reverse Integer Medium
- Reverse String Easy
- String Compression Medium
- Longest Subarray of 1's After Deleting One Element Medium
- Maximum Number of Occurrences of a Substring Medium
- Running Sum of 1d Array Easy
- Left and Right Sum Differences Easy
- Minimum Deletions to Make Character Frequencies Unique Medium
- Remove Covered Intervals Medium
Week 2: Counting Sort, Binary Search, Stack +5
12 problems on Counting Sort, Binary Search, Stack, Queue, Monotonic Stack, Matrix, Simulation and Greedy, easiest first within each topic.
- Height Checker Easy
- Count Negative Numbers in a Sorted Matrix Easy
- Longest Valid Parentheses Hard
- First Unique Character in a String Easy
- Maximal Rectangle Hard
- Unique Paths II Medium
- Minimum Path Sum Medium
- Build Array from Permutation Easy
- Game of Life Medium
- Count and Say Medium
- Can Place Flowers Easy
- Integer to Roman Medium
Week 3: Recursion, Divide and Conquer, Quickselect +8
12 problems on Recursion, Divide and Conquer, Quickselect, Heap, Bit Manipulation, Bitmask, Backtracking, Graph, Breadth-First Search, Union Find and Shortest Path, easiest first within each topic.
- Power of Four Easy
- Number of 1 Bits Easy
- K Closest Points to Origin Medium
- The K Weakest Rows in a Matrix Easy
- Ugly Number II Medium
- Sum of Two Integers Medium
- Minimum Number of Work Sessions to Finish the Tasks Medium
- Word Search Medium
- Keys and Rooms Medium
- Word Ladder Hard
- Surrounded Regions Medium
- Number of Restricted Paths From First to Last Node Hard
Week 4: Dynamic Programming
4 problems on Dynamic Programming, easiest first.
- Delete Operation for Two Strings Medium
- Interleaving String Medium
- Last Stone Weight II Medium
- Best Time to Buy and Sell Stock III Hard
Finally: the timed test
Sit the Microsoft — Online Assessment mock under the clock — the coding problems are only one part of the round.
Microsoft test patterns
- Microsoft — Online Assessment pattern guide and timed mock
All problems tagged Microsoft
Easy (45)
- Determine the Winner of a Bowling Game Array, Simulation
- Minimum Moves to Convert String String, Greedy
- Take Gifts From the Richest Pile Array, Heap, Simulation
- Sqrt(x) Math, Binary Search
- Find Smallest Letter Greater Than Target Array, Binary Search
- Count Subarrays of Length Three With a Condition Array, Sliding Window
- Defuse the Bomb Array, Sliding Window, Simulation
- Maximum Sum Subarray of Size K Array, Sliding Window
- Add to Array-Form of Integer Array, Math
- Longest Nice Substring String, Divide and Conquer
- Greatest Common Divisor of Strings String, Math
- Minimum Operations to Make the Array Increasing Array, Greedy
- Minimum Value to Get Positive Step by Step Sum Array, Prefix Sum
- Convert a Number to Hexadecimal Math, Bit Manipulation
- Power of Four Math, Bit Manipulation, Recursion
- Number of 1 Bits Divide and Conquer, Bit Manipulation
- Sort Even and Odd Indices Independently Array, Sorting
- Special Positions in a Binary Matrix Array, Matrix
- Find Winner on a Tic Tac Toe Game Array, Hash Table, Matrix
- Convert 1D Array Into 2D Array Array, Matrix, Simulation
- Row With Maximum Ones Array, Matrix
- The K Weakest Rows in a Matrix Array, Binary Search, Sorting
- Shift 2D Grid Array, Matrix, Simulation
- Count Negative Numbers in a Sorted Matrix Array, Binary Search, Matrix
- Reshape the Matrix Array, Matrix, Simulation
- Maximum Count of Positive Integer and Negative Integer Array, Binary Search, Counting
- Left and Right Sum Differences Array, Prefix Sum
- Remove Element Array, Two Pointers
- Check If Two String Arrays Are Equivalent Array, String
- Unique Email Addresses Array, Hash Table, String
- Rotate String String, String Matching
- Shuffle String Array, String
- Repeated Substring Pattern String, String Matching
- Length of Last Word String
- First Unique Character in a String Hash Table, String, Queue
- Relative Sort Array Array, Hash Table, Sorting
- Height Checker Array, Sorting, Counting Sort
- Can Place Flowers Array, Greedy
- Max Consecutive Ones Array
- Build Array from Permutation Array, Simulation
- Running Sum of 1d Array Array, Prefix Sum
- Roman to Integer Hash Table, Math, String
- Excel Sheet Column Title Math, String
- Excel Sheet Column Number Math, String
- Reverse String Two Pointers, String
Medium (90)
- Find the Winner of an Array Game Array, Simulation
- Find the Winner of the Circular Game Array, Math, Recursion
- Stone Game VII Array, Math, Dynamic Programming
- Minimum Number of Work Sessions to Finish the Tasks Array, Dynamic Programming, Bit Manipulation
- Count Fertile Pyramids in a Land Array, Dynamic Programming, Matrix
- Number of Ways to Divide a Long Corridor Math, String, Dynamic Programming
- Construct String With Repeat Limit Hash Table, String, Greedy
- Minimum Number of Changes to Make Binary String Beautiful String, Greedy
- Alternating Groups II Array, Sliding Window
- Maximum Value of an Ordered Triplet II Array, Prefix Sum
- Process Tasks Using Servers Array, Simulation, Heap (Priority Queue)
- Number of Ways to Arrive at Destination Graph, Dynamic Programming, Shortest Path
- Shortest Path with Alternating Colors Graph, Breadth-First Search
- Maximum Number of Fish in a Grid Array, Matrix, Depth-First Search
- Map of Highest Peak Array, Matrix, Breadth-First Search
- Convert an Array Into a 2D Array With Conditions Array, Matrix, Hash Table
- Rotating the Box Array, Matrix, Two Pointers
- Difference Between Ones and Zeros in Row and Column Array, Matrix, Simulation
- Count Alternating Subarrays Array, Math, Dynamic Programming
- Maximum Consecutive Floors Without Special Floors Array, Sorting, Greedy
- Removing Minimum and Maximum From Array Array, Greedy
- Search a 2D Matrix II Array, Matrix, Binary Search
- Find First and Last Position of Element in Sorted Array Array, Binary Search
- Minimum Consecutive Cards to Pick Up Array, Hash Table, Sliding Window
- Count Complete Subarrays in an Array Array, Hash Table, Sliding Window
- K Radius Subarray Averages Array, Sliding Window, Prefix Sum
- The k Strongest Values in an Array Array, Two Pointers, Sorting
- Super Ugly Number Dynamic Programming, Math, Heap
- Minimum Operations to Reduce an Integer to 0 Bit Manipulation, Greedy, Dynamic Programming
- 4Sum II Hash Table, Array, Counting
- Maximum Size Subarray Sum Equals k Array, Hash Table, Prefix Sum
- Maximum Number of Occurrences of a Substring String, Sliding Window, Hash Table
- Kth Smallest Element Array, Sorting, Quickselect
- Maximum Index Array, Two Pointers
- Count Inversions Array, Divide and Conquer, Fenwick Tree
- K-diff Pairs in an Array Array, Hash Table
- Word Search Array, String, Backtracking
- Snakes and Ladders Array, Breadth-First Search, Matrix
- Minimum Genetic Mutation Hash Table, String, Breadth-First Search
- Maximal Network Rank Graph
- Path With Minimum Effort Array, Binary Search, Depth-First Search
- Time Needed to Inform All Employees Tree, Depth-First Search, Breadth-First Search
- Reorder Routes to Make All Paths Lead to the City Zero Depth-First Search, Breadth-First Search, Graph
- Number of Operations to Make Network Connected Depth-First Search, Breadth-First Search, Union Find
- Find Eventual Safe States Depth-First Search, Breadth-First Search, Graph
- Keys and Rooms Depth-First Search, Breadth-First Search, Graph
- Bulb Switcher Math, Brainteaser
- Divide Two Integers Math, Bit Manipulation
- Gray Code Math, Backtracking, Bit Manipulation
- Maximum XOR of Two Numbers in an Array Array, Hash Table, Bit Manipulation
- Sum of Two Integers Math, Bit Manipulation
- Bitwise AND of Numbers Range Bit Manipulation
- Single Number II Array, Bit Manipulation
- Dota2 Senate String, Greedy, Queue
- Reverse Substrings Between Each Pair of Parentheses String, Stack
- Basic Calculator II Math, String, Stack
- Validate Stack Sequences Array, Stack, Simulation
- Next Greater Element III Math, Two Pointers, String
- K Closest Points to Origin Array, Math, Divide and Conquer
- Partition Array into Disjoint Intervals Array, Greedy
- Maximum Swap Math, Greedy
- Largest Number Array, String, Greedy
- Remove Covered Intervals Array, Greedy, Sorting
- Minimum Number of Steps to Make Two Strings Anagram Hash Table, String, Counting
- Minimum Deletions to Make Character Frequencies Unique String, Hash Table, Greedy
- Reduce Array Size to The Half Array, Hash Table, Greedy
- Queue Reconstruction by Height Array, Greedy, Sorting
- Knight Dialer Dynamic Programming
- Last Stone Weight II Array, Dynamic Programming
- Ugly Number II Hash Table, Math, Dynamic Programming
- Interleaving String String, Dynamic Programming
- Delete Operation for Two Strings String, Dynamic Programming
- Count Servers that Communicate Array, Depth-First Search, Breadth-First Search
- Surrounded Regions Array, Depth-First Search, Breadth-First Search
- Game of Life Array, Matrix, Simulation
- Unique Paths II Array, Dynamic Programming, Matrix
- Minimum Path Sum Array, Dynamic Programming, Matrix
- Sort the Matrix Diagonally Array, Sorting, Matrix
- Spiral Matrix II Array, Matrix, Simulation
- Remove Duplicates from Sorted Array II Array, Two Pointers
- Longest Subarray of 1's After Deleting One Element Array, Dynamic Programming, Sliding Window
- String Compression Two Pointers, String
- Count and Say String, Simulation
- Reverse Words in a String Two Pointers, String
- Increasing Triplet Subsequence Array, Greedy
- Next Permutation Array, Two Pointers
- Find All Duplicates in an Array Array, Hash Table
- Integer to Roman Hash Table, Math, String
- Count Primes Math, Sieve of Eratosthenes
- Reverse Integer Math
Hard (55)
- Count Ways to Make Array With Product Array, Math, Dynamic Programming
- Maximum Number of Events That Can Be Attended II Array, Binary Search, Dynamic Programming
- Create Sorted Array Through Instructions Array, Binary Search, Divide and Conquer
- Painting the Walls Array, Dynamic Programming
- Painting a Grid With Three Different Colors Dynamic Programming, Bitmask
- Minimum Incompatibility Array, Dynamic Programming, Bit Manipulation
- Number of Distinct Roll Sequences Dynamic Programming, Memoization
- Form Largest Integer With Digits That Add up to Target Array, String, Dynamic Programming
- Build Array Where You Can Find The Maximum Exactly K Comparisons Dynamic Programming, Prefix Sum
- Allocate Mailboxes Array, Math, Dynamic Programming
- Restore the Array String, Dynamic Programming
- Maximum Height by Stacking Cuboids Array, Dynamic Programming, Sorting
- Cherry Pickup II Array, Dynamic Programming, Matrix
- Number of Ways to Stay in the Same Place After Some Steps Dynamic Programming
- Maximum Value of K Coins From Piles Array, Dynamic Programming, Prefix Sum
- Count Special Integers Math, Dynamic Programming, Combinatorics
- Number of Great Partitions Array, Dynamic Programming
- Paths in Matrix Whose Sum Is Divisible by K Array, Dynamic Programming, Matrix
- Smallest K-Length Subsequence With Occurrences of a Letter String, Stack, Greedy
- Valid Palindrome III String, Dynamic Programming
- String Compression II String, Dynamic Programming
- Apply Operations to Maximize Score Array, Math, Stack
- Meeting Rooms III Array, Sorting, Simulation
- Maximum Performance of a Team Array, Greedy, Sorting
- Construct Target Array With Multiple Sums Array, Heap (Priority Queue), Math
- Minimum Number of Operations to Make Array Continuous Array, Hash Table, Binary Search
- Put Marbles in Bags Array, Greedy, Sorting
- Minimum Time to Visit a Cell In a Grid Array, Matrix, Graph
- Minimum Number of Days to Disconnect Island Array, Matrix, Depth-First Search
- Checking Existence of Edge Length Limited Paths Array, Union Find, Graph
- Minimum Obstacle Removal to Reach Corner Array, Matrix, Graph
- Largest Component Size by Common Factor Array, Math, Union Find
- Critical Connections in a Network Graph, Depth-First Search, Biconnected Component
- Number of Restricted Paths From First to Last Node Graph, Dynamic Programming, Shortest Path
- Jump Game IV Array, Hash Table, Breadth-First Search
- Escape the Spreading Fire Array, Matrix, Binary Search
- Making A Large Island Array, Matrix, Depth-First Search
- Unique Paths III Array, Matrix, Backtracking
- Maximal Rectangle Array, Matrix, Stack
- Minimum Cost to Cut a Stick Array, Dynamic Programming, Sorting
- Scramble String String, Dynamic Programming
- Distinct Subsequences II String, Dynamic Programming
- Frog Jump Array, Hash Table, Dynamic Programming
- Dungeon Game Array, Matrix, Dynamic Programming
- Russian Doll Envelopes Array, Binary Search, Dynamic Programming
- Split Array Largest Sum Array, Binary Search, Greedy
- Shortest Subarray with Sum at Least K Array, Prefix Sum, Sliding Window
- Subarrays with K Different Integers Array, Hash Table, Sliding Window
- Number of Digit One Math, Digit DP, Recursion
- Longest Happy Prefix String, KMP, Rolling Hash
- Shortest Palindrome String, KMP, Rolling Hash
- Word Ladder Hash Table, String, Breadth-First Search
- Longest Valid Parentheses String, Dynamic Programming, Stack
- Count Vowels Permutation Dynamic Programming
- Best Time to Buy and Sell Stock III Array, Dynamic Programming
Topics Microsoft asks most
- Arrays 119 problems
- Dynamic Programming 47 problems
- Strings 44 problems
- Matrix 35 problems
- Math 32 problems
- Hash Table 26 problems
- Sorting 24 problems
- Greedy 24 problems
- Breadth-First Search 20 problems
- Simulation 18 problems
- Heap 16 problems
- Binary Search 15 problems