Skip to content

Microsoft Coding Questions 2025 - DSA Problems & System Design with Solutions

Practice 25+ Microsoft placement paper coding questions with detailed solutions. Access Microsoft OA coding problems, DSA questions, and system design for Microsoft placement 2025-2026.

Microsoft Placement Paper Coding Questions - Complete Guide

Section titled “Microsoft Placement Paper Coding Questions - Complete Guide”

Practice with 25+ Microsoft placement paper coding questions covering DSA problems, algorithms, and system design concepts. These questions are representative of what you’ll encounter in Microsoft’s online assessment and technical interviews.

What’s Included:

  • 25+ Coding Problems: Easy, Medium, and Hard level questions with solutions
  • Multiple Language Solutions: C++, Java, Python, and C# solutions
  • Time Complexity Analysis: Every solution includes complexity analysis
  • Microsoft-Specific Patterns: Focus on arrays, trees, graphs, dynamic programming

Microsoft Placement Papers 2024

Access 2024 Microsoft OA questions with solutions and exam pattern analysis.


View 2024 Papers →

Microsoft Placement Papers 2025

Practice latest 2025 Microsoft OA questions with updated patterns.


View 2025 Papers →

Complete Microsoft Guide

Access complete Microsoft placement papers guide with eligibility, process, and preparation strategy.


View Complete Guide →

Microsoft Online Assessment Breakdown:

SectionQuestionsTimeDifficultyFocus Areas
Coding Test3-490 minMedium-HardArrays, trees, graphs, DP, system design

Languages Allowed: C, C++, Java, Python, C#

Two Sum

Problem: Find indices of two numbers that add up to target.

Example:

Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]

Solution (C++):

vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> map;
for (int i = 0; i < nums.size(); i++) {
int complement = target - nums[i];
if (map.find(complement) != map.end()) {
return {map[complement], i};
}
map[nums[i]] = i;
}
return {};
}

Solution (Python):

def two_sum(nums, target):
seen = {}
for i, num in enumerate(nums):
if target - num in seen:
return [seen[target - num], i]
seen[num] = i
return []

Time Complexity: O(n) | Space Complexity: O(n)

Valid Parentheses

Problem: Check if string with brackets is valid.

Example:

Input: "()[]{}"
Output: true

Solution (C++):

bool isValid(string s) {
stack<char> st;
unordered_map<char, char> pairs = {{')', '('}, {'}', '{'}, {']', '['}};
for (char c : s) {
if (pairs.count(c)) {
if (st.empty() || st.top() != pairs[c]) return false;
st.pop();
} else {
st.push(c);
}
}
return st.empty();
}

Solution (Python):

def is_valid(s):
stack = []
mapping = {')': '(', '}': '{', ']': '['}
for char in s:
if char in mapping:
if not stack or stack.pop() != mapping[char]:
return False
else:
stack.append(char)
return len(stack) == 0

Time Complexity: O(n) | Space Complexity: O(n)

Reverse Linked List

Problem: Reverse a singly linked list.

Solution (C++):

ListNode* reverseList(ListNode* head) {
ListNode* prev = nullptr;
ListNode* curr = head;
while (curr) {
ListNode* next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
}
return prev;
}

Solution (Python):

def reverse_list(head):
prev = None
curr = head
while curr:
next_temp = curr.next
curr.next = prev
prev = curr
curr = next_temp
return prev

Time Complexity: O(n) | Space Complexity: O(1)

Merge Two Sorted Lists

Problem: Merge two sorted linked lists.

Solution (C++):

ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode dummy(0);
ListNode* curr = &dummy;
while (l1 && l2) {
if (l1->val < l2->val) {
curr->next = l1;
l1 = l1->next;
} else {
curr->next = l2;
l2 = l2->next;
}
curr = curr->next;
}
curr->next = l1 ? l1 : l2;
return dummy.next;
}

Time Complexity: O(n+m) | Space Complexity: O(1)

Maximum Depth of Binary Tree

Problem: Find maximum depth of binary tree.

Solution (C++):

int maxDepth(TreeNode* root) {
if (!root) return 0;
return 1 + max(maxDepth(root->left), maxDepth(root->right));
}

Solution (Python):

def max_depth(root):
if not root:
return 0
return 1 + max(max_depth(root.left), max_depth(root.right))

Time Complexity: O(n) | Space Complexity: O(h)

Master DSA Fundamentals

  • Arrays, strings, trees, graphs
  • Dynamic programming patterns
  • Linked lists, stacks, queues
  • Hash maps and sets

Focus on Optimization

  • Microsoft values optimal solutions
  • Know time/space tradeoffs
  • Practice Big O analysis
  • Multiple approaches per problem

Time Management

  • 20-25 minutes per problem
  • Read problem carefully
  • Test with edge cases
  • Optimize if time permits

Common Patterns

  • Two pointers
  • Sliding window
  • Binary search
  • BFS/DFS
  • Dynamic programming
  • Graph algorithms
Practice More Microsoft Coding Questions →

Practice Microsoft coding questions regularly! Focus on medium-hard DSA problems. Microsoft values optimal solutions and clean code.

Pro Tip: Microsoft interviews emphasize problem-solving approach. Think out loud and communicate your thought process clearly.

Last updated: February 2026