Skip to main content

Microsoft Coding Interview Questions

184 problems · 23 Easy 152 Medium 9 Hard
✓ Interview Solutions & Breakdown Practice Mode Enabled
← All problems

Microsoft problems

Microsoft runs four to five rounds including a preparation session and an ASK (Ask-See-Know) behavioral component. Coding skews toward medium arrays, strings, and trees with an emphasis on communication. Clear trade-off discussion is scored as highly as the code itself.

📋

Microsoft Interview Loop Structure

🔄
Rounds: 4–5 rounds including technical problem solving and ASK behavioral component
💻
Coding Style: Medium arrays, strings, linked lists, and tree traversals. Emphasis on readability and edge case correctness.
🏗
System Design: Required for L63+. Enterprise scalability, cloud architecture (Azure-style services), and modular design.
🎯
Behavioral: Growth Mindset and collaboration: learning from failures, cross-team alignment, and empathy.
💡
Pro Tips:
  • • Clear trade-off discussion is weighted as heavily as final code execution
  • • Think out loud continuously throughout the session
  • • Ask clarifying questions on input bounds and null safety
🎯

4-Week Preparation Strategy for Microsoft

Action Plan

To maximize your offer probability at Microsoft, avoid random LeetCode grinding. Follow this structured 4-week roadmap tailored to Microsoft's specific interview loop and evaluation bar:

Week 1: High-Frequency Patterns

Focus on foundational patterns tested heavily at Microsoft: Two Pointers, Sliding Window, and Hash Map frequency tracking. Solve 10–12 Easy/Medium questions and establish code muscle memory without syntax lookups.

Week 2: Advanced Graph & Tree Drills

Master BFS, DFS, Topological Sorting, and Priority Queues (Min/Max Heaps). Practice articulating state transitions and recursion stack depth trade-offs under real-time interviewer pressure.

Week 3: Timed Mock Coding & Complexity

Simulate real 45-minute technical screens. Spend 5 minutes clarifying requirements, 10 minutes discussing brute-force vs optimal trade-offs, 20 minutes coding cleanly, and 10 minutes dry-running boundary test cases.

Week 4: System Architecture & Behavioral STAR

Draft 5 distinct STAR method stories (Situation, Task, Action, Result) mapped to Microsoft's core principles. Review distributed systems fundamentals: caching tiers, partitioning, rate limiting, and database consistency models.

💡 What Microsoft Interviewers Evaluate:

Interviewers score candidates across 4 independent pillars: Algorithmic Optimality (arriving at optimal Big-O), Code Craftsmanship (modular functions, clean naming, zero syntax debt), Communication & Thinking Out Loud (proactive collaboration, asking clarifying questions), and Edge Case Rigor (null checks, integer overflows, duplicate inputs).

Two Pointers 42 problems
Problem Difficulty Solution Link
Valid Palindrome
#String #Two Pointers
Easy Solution
Remove Duplicates from Sorted Array
#Array #Two Pointers
Easy Solution
Sort Colors
#Array #Sorting #Two Pointers
Medium Solution
Valid Palindrome II
#String #Greedy #Two Pointers
Easy Solution
Encode and Decode Strings
#Array #String #Design
Medium Solution
Best Time to Buy and Sell the Stocks - 2
#Array
Medium Solution
3Sum Closest
#Array
Medium Solution
Intersection of two Arrays
#Array
Medium Solution
Maximum Sum Rectangle
#Array
Medium Solution
Rotate Array
#Array
Medium Solution
Majority Element
#Array
Easy Solution
Majority Element II
#Array
Easy Solution
Next Greater Element III
#Array
Medium Solution
Merge Sort
#Array
Medium Solution
Count Inversions
#Array
Medium Solution
First Missing Positive
#Array
Medium Solution
Repeat and Missing Number Array
#Array
Medium Solution
Minimum Platforms
#Array
Medium Solution
Max sum path in two arrays
#Array
Medium Solution
Pairs of Songs With Total Durations Divisible by 60
#Array
Medium Solution
Rectangle Overlap
#Array
Medium Solution
Find the Duplicate Number
#Array
Medium Solution
Segregate Even and Odd numbers
#Array
Medium Solution
Subarray with 0 sum exist
#Array
Medium Solution
Count Numbers with Unique Digits
#Array
Medium Solution
Distribute Candies
#Array
Medium Solution
Transpose Matrix
#Array
Medium Solution
Pascals Triangle
#Array
Medium Solution
Insert Delete GetRandom in O
#Array
Medium Solution
Sign of the Product of an Array
#Array
Medium Solution
Find N Unique Integers Sum up to Zero
#Array
Medium Solution
Shuffle an Array
#Array
Medium Solution
Count Primes
#Array
Medium Solution
Power of Three
#Array
Medium Solution
Hamming Distance
#Array
Medium Solution
Excel Sheet Column Number
#Array
Medium Solution
Excel Sheet Column Title
#Array
Medium Solution
Happy Number
#Array
Medium Solution
Assign Cookies
#Array
Medium Solution
Reverse words in a given string
#String
Medium Solution
Reverse Words in a String
#String
Medium Solution
Minimum Number of Moves to Make Palindrome
#String
Medium Solution
Prefix Sum 3 problems
Problem Difficulty Solution Link
Product of Array Except Self
#Array #Prefix Product
Medium Solution
Max Chunks To Make Sorted
#Array
Medium Solution
Max Chunks To Make Sorted II
#Array
Medium Solution
Hash Map / Set 4 problems
Problem Difficulty Solution Link
Two Sum
#Array #Hash Map
Easy Solution
Group Anagrams
#String #Hash Map #Sorting
Medium Solution
Valid Anagram
#String #Hash Map #Sorting
Easy Solution
LRU Cache
#Hash Table #Linked List #Design
Medium Solution
Queue / BFS 3 problems
Problem Difficulty Solution Link
Number of Islands
#Array #DFS #BFS
Medium Solution
Binary Tree Level Order Traversal
#Tree #BFS
Medium Solution
01 Matrix
#Array #BFS #Matrix
Medium Solution
Problem Difficulty Solution Link
Find Median from Data Stream
#Two Heaps #Design #Sorting
Hard Solution
Merge K Sorted Lists
#Linked List #Heap #Divide and Conquer
Hard Solution
Sort an Almost Sorted Array
#Heap #Priority Queue
Medium Solution
Find K Closest Elements
#Heap #Priority Queue
Medium Solution
Connect Ropes to Minimize the Cost
#Heap #Priority Queue
Medium Solution
The sum of Elements between k1 smallest and k2 smallest numbers
#Heap #Priority Queue
Medium Solution
Kth Largest Element in a Stream
#Heap #Priority Queue
Medium Solution
Linked List 23 problems
Problem Difficulty Solution Link
Reverse Linked List
#Linked List #Recursion
Easy Solution
Linked List Cycle
#Linked List #Two Pointers #Hash Table
Easy Solution
Merge Two Sorted Lists
#Linked List #Recursion
Easy Solution
Add Two Numbers
#Linked List #Math #Recursion
Medium Solution
Remove Nth Node From End of List
#Linked List #Two Pointers
Medium Solution
Copy List with Random Pointer
#Hash Table #Linked List
Medium Solution
Palindrome Linked List
#Linked List #Two Pointers #Stack
Easy Solution
Swap Nodes in Pairs
#Linked List #Recursion
Medium Solution
Rotate List
#Linked List #Two Pointers
Medium Solution
Reverse Nodes in k-Group
#Linked List #Recursion
Hard Solution
Find the intersection of two linked lists
#Linked List
Medium Solution
Middle of the Linked List
#Linked List
Easy Solution
Add Two Numbers Represented in Linked List
#Linked List
Medium Solution
Linked List Cycle II
#Linked List
Medium Solution
Remove Duplicates from Sorted List
#Linked List
Easy Solution
Remove Duplicates from Sorted List - II
#Linked List
Easy Solution
Add Two Numbers II
#Linked List
Medium Solution
Odd Even Linked List
#Linked List
Medium Solution
Reverse a Linked List in groups of given size k
#Linked List
Medium Solution
Reverse Linked List II
#Linked List
Medium Solution
Convert Binary Number in a Linked List to Integer
#Linked List
Medium Solution
Partition List
#Linked List
Medium Solution
Sort List
#Linked List
Medium Solution
Trees / DFS 10 problems
Problem Difficulty Solution Link
Validate Binary Search Tree
#Tree #DFS #BST
Medium Solution
Binary Tree Maximum Path Sum
#Tree #DFS #DP
Hard Solution
Symmetric Tree
#Tree #DFS #BFS
Easy Solution
Kth Smallest Element in a BST
#Tree #DFS #BST
Medium Solution
Construct Binary Tree from Preorder and Inorder Traversal
#Array #Hash Table #Divide and Conquer
Medium Solution
Path Sum II
#Backtracking #Tree #DFS
Medium Solution
Flatten Binary Tree to Linked List
#Linked List #Stack #Tree
Medium Solution
Populating Next Right Pointers in Each Node
#Linked List #Tree #DFS
Medium Solution
Same Tree
#Tree #Depth-First Search #Breadth-First Search
Easy Solution
Subtree of Another Tree
#Tree #Depth-First Search #String Matching
Easy Solution
Problem Difficulty Solution Link
Coin Change
#Array #DP #BFS
Medium Solution
Longest Increasing Subsequence
#Array #DP #Binary Search
Medium Solution
Maximum Subarray
#Array #DP #Divide and Conquer
Medium Solution
Decode Ways
#String #DP
Medium Solution
Best Time to Buy and Sell Stock
#Array #Dynamic Programming
Easy Solution
Longest Palindromic Substring
#String #Dynamic Programming
Medium Solution
Maximum Product Subarray
#Array #Dynamic Programming
Medium Solution
Regular Expression Matching
#String #Dynamic Programming #Recursion
Hard Solution
Greedy 3 problems
Problem Difficulty Solution Link
Jump Game
#Array #Greedy #DP
Medium Solution
Meeting Rooms II
#Array #Greedy #Sorting
Medium Solution
Minimum Number of Arrows to Burst Balloons
#Array #Greedy #Sorting
Medium Solution
Backtracking 9 problems
Problem Difficulty Solution Link
Permutations
#Array #Backtracking
Medium Solution
Word Search
#Array #Matrix #Backtracking
Medium Solution
Letter Combinations of a Phone Number
#Hash Table #String #Backtracking
Medium Solution
Generate Parentheses
#String #Dynamic Programming #Backtracking
Medium Solution
N-Queens
#Array #Backtracking
Hard Solution
Next Permutation
#Array
Medium Solution
Find all permutations of a string
#String
Medium Solution
Find all permutations of a given string without duplicates
#String
Medium Solution
Longest Valid Parentheses
#String
Easy Solution
Trie 2 problems
Problem Difficulty Solution Link
Implement Trie (Prefix Tree)
#Design #Trie
Medium Solution
Word Search II
#Array #String #Backtracking
Hard Solution
Problem Difficulty Solution Link
Missing Number
#Array #Math #Bit Manipulation
Easy Solution
Number of 1 Bits
#Divide and Conquer #Bit Manipulation
Easy Solution
Sum of Two Integers
#Math #Bit Manipulation
Medium Solution
Matrix 5 problems
Problem Difficulty Solution Link
Rotate Image
#Array #Matrix #Math
Medium Solution
Spiral Matrix
#Array #Matrix #Simulation
Medium Solution
Set Matrix Zeroes
#Array #Matrix
Medium Solution
Game of Life
#Array #Matrix #Simulation
Medium Solution
Search a 2D Matrix II
#Array #Binary Search #Divide and Conquer
Medium Solution
Graphs 2 problems
Problem Difficulty Solution Link
Surrounded Regions
#Array #DFS #BFS
Medium Solution
Network Delay Time
#DFS #BFS #Graph
Medium Solution
Problem Difficulty Solution Link
Online Stock Span
#Stack #Design #Monotonic Stack
Medium Solution
Stock Span Problem
#Stack
Medium Solution
Intervals 1 problems
Problem Difficulty Solution Link
Meeting Rooms
#Array #Sorting
Easy Solution
Buy me a coffee
Daily Practice
0/0