HackTheRounds Interview Experiences

Microsoft OA HackerRank Questions 2026: Latest Problems, Patterns & Solutions Guide

Breakdown of Microsoft's 2026 Online Assessment questions on HackerRank/Codility: alloy production, team formation, XOR pairs, and MEX problems.

By HackTheRounds Team · 2026-04-01

Overview

Microsoft's 2026 OA for SDE roles uses HackerRank or Codility, with 2 problems in 75-90 minutes . Difficulty ranges from medium to medium-hard — more accessible than Uber or Optiver, but still requires solid prep.

Problem 1: Maximum Production Quantity of Alloy

Difficulty: Medium | Topics: Binary Search, Greedy

Given composition requirements per alloy unit, current stock levels, per-unit material costs, and a budget, calculate the maximum number of alloy units you can produce.

Approach: Binary search on the answer. For a candidate production quantity k , check if the total cost to buy missing materials fits within budget. The cost function is monotonic, making binary search ideal.

Key Insight: For each material, you need max(0, k requirement - stock) additional units. Sum the costs and compare against budget.

Problem 2: Maximum Team Size

Difficulty: Medium | Topics: Graph, Interval Overlap

Find the maximum team size where at least one employee can interact with all other team members, given working hour intervals.

Approach: For each employee, count how many others have overlapping work hours. The answer is max(overlap count) + 1 . The key is efficiently computing pairwise overlaps — sort by start time and use a sweep line.

Problem 3: Dominating XOR

Difficulty: Medium | Topics: Bit Manipulation

Count unordered pairs (i, j) where XOR(a[i], a[j]) AND(a[i], a[j]) .

Approach: For XOR AND, the highest differing bit must be higher than the highest common bit. Group numbers by their highest set bit and count valid pairs across groups.

Problem 4: Maximum Possible MEX

Difficulty: Medium | Topics: Greedy, Sorting

You can decrement any element by 1 any number of times. Find the maximum MEX (smallest missing non-negative integer) achievable.

Approach: Sort the array. Greedily assign each number to the smallest gap: if a[i] = target , decrement it to target and increment target. If a[i] < target , skip it.

Microsoft OA Prep Tips

  1. Medium difficulty, but broad topics — expect binary search, graphs, bit manipulation, and greedy
  2. 75-90 minutes for 2 problems — generous time, focus on correctness over speed
  3. Microsoft values clean code — variable names, comments, and structure matter
  4. After OA: Phone screen + 4-5 onsite rounds. The onsite is more behavioral-heavy than other companies

Practice Microsoft interview questions on HackTheRounds.