Preparing for a Microsoft software engineering, embedded software, firmware or systems programming interview? This practice bank combines standard data structures and algorithms (DSA) with low-level C programming, memory management and concurrency. It is suitable for experienced engineers as well as candidates revising core coding fundamentals.
★ = High-priority practice question. Each question includes a suggested approach or key concept. This is a curated preparation list, not a verified list of questions asked by Microsoft or any individual interviewer. Actual interviews vary by team, level and role.
For the interview process and embedded-specific preparation, see the Microsoft interview guide. For runnable C and C++ exercises, visit Coding Practice.
Arrays and matrices — 20 questions
| No. |
Coding question |
Approach / key concept |
| 1 |
★ Two Sum |
Hash table |
| 2 |
★ Three Sum |
Sorting + two pointers |
| 3 |
★ Maximum subarray sum |
Kadane's algorithm |
| 4 |
★ Product of array except self |
Prefix and suffix |
| 5 |
★ Move all zeroes to the end |
Two pointers |
| 6 |
Remove duplicates from a sorted array |
Two pointers |
| 7 |
Remove duplicates from an unsorted array |
Hash table |
| 8 |
★ Rotate an array by K positions |
Reversal algorithm |
| 9 |
★ Merge overlapping intervals |
Sorting |
| 10 |
Merge two sorted arrays in-place |
Two pointers |
| 11 |
★ Sort an array of 0s, 1s and 2s |
Dutch National Flag |
| 12 |
Find the majority element |
Boyer-Moore |
| 13 |
Find the missing and repeating numbers |
XOR |
| 14 |
Find the longest consecutive sequence |
Hash table |
| 15 |
Best time to buy and sell stock |
Greedy |
| 16 |
★ Find subarray sum equal to K |
Prefix sum + hashing |
| 17 |
Trapping rainwater |
Two pointers |
| 18 |
★ Rotate a matrix by 90 degrees |
Transpose + reversal |
| 19 |
Print a matrix in spiral order |
Boundary traversal |
| 20 |
Set matrix rows and columns to zero |
In-place marking |
Strings — 10 questions
| No. |
Coding question |
Approach / key concept |
| 21 |
★ Longest substring without repeating characters |
Sliding window |
| 22 |
★ Check whether two strings are anagrams |
Frequency array |
| 23 |
Reverse a string in-place |
Two pointers |
| 24 |
★ Reverse words in a string |
Two pointers |
| 25 |
Find the first non-repeating character |
Frequency array |
| 26 |
Check whether a string is a palindrome |
Two pointers |
| 27 |
Longest palindromic substring |
Expand around center |
| 28 |
★ Implement atoi() with overflow handling |
Parsing |
| 29 |
Group anagrams |
Hashing |
| 30 |
Minimum window substring |
Sliding window |
Linked lists — 12 questions
| No. |
Coding question |
Approach / key concept |
| 31 |
★ Reverse a singly linked list |
Three pointers |
| 32 |
★ Detect a loop in a linked list |
Floyd's algorithm |
| 33 |
★ Find the starting node of a loop |
Slow and fast pointers |
| 34 |
Find the middle node |
Slow and fast pointers |
| 35 |
★ Merge two sorted linked lists |
Pointer manipulation |
| 36 |
Merge K sorted linked lists |
Min-heap |
| 37 |
Delete the Nth node from the end |
Two pointers |
| 38 |
Find the intersection of two linked lists |
Two pointers |
| 39 |
Check whether a linked list is a palindrome |
Reversal |
| 40 |
★ Reverse linked list nodes in groups of K |
Pointer manipulation |
| 41 |
Clone a linked list with random pointers |
Hashing/interleaving |
| 42 |
Add two numbers represented by linked lists |
Carry propagation |
Stack, queue, heap and hash table — 10 questions
| No. |
Coding question |
Approach / key concept |
| 43 |
★ Valid parentheses |
Stack |
| 44 |
Implement a stack using queues |
Queue |
| 45 |
Implement a queue using stacks |
Stack |
| 46 |
★ Design a stack supporting minimum in O(1) |
Min-stack |
| 47 |
Next greater element |
Monotonic stack |
| 48 |
Sliding window maximum |
Monotonic deque |
| 49 |
★ Implement a circular buffer |
Ring buffer |
| 50 |
★ Implement a hash table from scratch in C |
Hashing |
| 51 |
★ Implement an LRU cache in O(1) |
Hash table + doubly linked list |
| 52 |
★ Implement a min-heap from scratch |
Binary heap |
Bit manipulation — 10 questions
| No. |
Coding question |
Approach / key concept |
| 53 |
★ Count the number of set bits |
Brian Kernighan |
| 54 |
Check whether a number is a power of two |
Bitwise AND |
| 55 |
★ Find a non-repeating number when others appear twice |
XOR |
| 56 |
★ Find a non-repeating number when others appear three times |
Bit counting |
| 57 |
Find two non-repeating numbers |
XOR partitioning |
| 58 |
★ Reverse all 32 bits of an integer |
Shifting |
| 59 |
★ Set, clear and toggle bits in a given range |
Bitmask |
| 60 |
★ Convert little-endian to big-endian |
Bitwise shifting |
| 61 |
Find the next power of two |
Bit propagation |
| 62 |
Add two integers without using + |
XOR and carry |
Trees and graphs — 12 questions
| No. |
Coding question |
Approach / key concept |
| 63 |
★ Implement inorder, preorder and postorder traversal |
DFS |
| 64 |
Binary tree level-order traversal |
BFS |
| 65 |
Find the maximum depth of a binary tree |
Recursion |
| 66 |
★ Validate a binary search tree |
DFS |
| 67 |
★ Find the lowest common ancestor |
Recursion |
| 68 |
Find the diameter of a binary tree |
DFS |
| 69 |
Find the Kth smallest element in a BST |
Inorder traversal |
| 70 |
Serialize and deserialize a binary tree |
DFS/BFS |
| 71 |
★ Number of islands |
DFS/BFS |
| 72 |
★ Rotting oranges |
Multi-source BFS |
| 73 |
Detect a cycle in a directed graph |
DFS |
| 74 |
Course schedule and dependency resolution |
Topological sorting |
Searching, sorting and dynamic programming — 9 questions
| No. |
Coding question |
Approach / key concept |
| 75 |
★ Implement binary search iteratively and recursively |
Binary search |
| 76 |
★ Search in a rotated sorted array |
Modified binary search |
| 77 |
Find the first and last occurrence of an element |
Binary search |
| 78 |
★ Implement quicksort |
Divide and conquer |
| 79 |
★ Implement merge sort |
Divide and conquer |
| 80 |
Find the Kth largest element in an array |
Quickselect/heap |
| 81 |
Coin change problem |
Dynamic programming |
| 82 |
Longest increasing subsequence |
DP/binary search |
| 83 |
Longest common subsequence |
Dynamic programming |
C, memory management and systems programming — 17 questions
| No. |
Coding question |
Approach / key concept |
| 84 |
★ Implement your own memcpy() |
Memory copying |
| 85 |
★ Implement your own memmove() |
Overlapping memory |
| 86 |
Implement your own strlen(), strcpy() and strcmp() |
Pointers |
| 87 |
★ Implement aligned malloc() and free() |
Memory alignment |
| 88 |
★ Allocate 64-byte aligned memory without malloc() |
Static memory |
| 89 |
Implement a fixed-size memory pool allocator |
Memory management |
| 90 |
Implement your own simplified malloc() and free() |
Free list |
| 91 |
★ Implement a bitmap-based resource allocator |
Bit manipulation |
| 92 |
★ Implement producer-consumer using mutex and semaphore |
Synchronization |
| 93 |
★ Implement a thread-safe queue |
Mutex and condition variable |
| 94 |
Implement a readers-writers lock |
Synchronization |
| 95 |
Implement a spinlock using atomic operations |
Atomicity |
| 96 |
★ Implement a reference-counting mechanism |
Resource management |
| 97 |
Implement a single-producer single-consumer lock-free ring buffer |
Memory ordering |
| 98 |
Implement a thread-safe LRU cache with expiration |
Cache + concurrency |
| 99 |
Implement a callback-based event registration and dispatch mechanism |
Function pointers |
| 100 |
★ Copy a rectangular region between two framebuffers with different strides |
Graphics and memory |
Top 20 questions to prepare first
If your interview is approaching, prioritize these questions from the list above:
- Implement an LRU cache in O(1) (Q51)
- Implement a circular buffer (Q49)
- Reverse a singly linked list (Q31)
- Detect a loop in a linked list (Q32)
- Longest substring without repeating characters (Q21)
- Merge overlapping intervals (Q9)
- Maximum subarray sum (Q3)
- Two Sum (Q1)
- Three Sum (Q2)
- Product of array except self (Q4)
- Search in a rotated sorted array (Q76)
- Count the number of set bits (Q53)
- Find a non-repeating number when others appear three times (Q56)
- Rotate a matrix by 90 degrees (Q18)
- Implement a min-heap from scratch (Q52)
- Implement your own
memmove() (Q85)
- Implement aligned
malloc() and free() (Q87)
- Implement producer-consumer using mutex and semaphore (Q92)
- Implement a thread-safe queue (Q93)
- Number of islands (Q71)
How to approach the coding interview
- Clarify the problem, input constraints and expected output.
- Explain a straightforward solution and then an optimized approach.
- Write compilable code in the language you know best, subject to the interview requirements.
- Dry-run your solution with representative inputs.
- Explain time and space complexity.
- Test corner cases, empty inputs, NULL pointers, integer overflow and memory lifetime where relevant.
- For systems questions, be ready to discuss synchronization, memory ordering, resource ownership and performance.
Revise Arrays & Strings, Data Structures, Bit Manipulation, Pointers & Memory, and RTOS for detailed explanations and examples.