Microsoft HackerRank assessment interview

Round 2 of 5 · 16 questions reported

See the whole loop
Length
90 min
Format
Two problems in a locked full-screen browser
Heads-up
Some teams use their own problem sets; the intern version can be 75 minutes.

Questions Microsoft asks in this round 16

  • Count non-decreasing arrays with given digit sumsCodingYou get an array requiredSum of length n. Count arrays result of length n that are non-decreasing and where the digit sum of resulti equals requiredSumi for every i, within the…
    Last asked Aug 2026
  • Balanced prefixes in a permutationCodingYou are given a permutation p of length n: every integer from 1 to n appears exactly once, in some order. Call a number k (with 1 <= k <= n) balanced if some contiguous subarray…
    Last asked Mar 2026
  • Count binary substringsCodingCount the non-empty substrings of a binary string that have the same number of 0s and 1s, with all the 0s together and all the 1s together. Solve it in one pass by comparing…
    Last asked Aug 2026
  • Delete and earnCodingTaking a value x from the array earns x points but deletes every x - 1 and x + 1. Return the most points you can earn. Explain how this reduces to the house robber recurrence over…
    Last asked Aug 2026
  • Maximum XOR productCodingGiven a, b and n, choose x with 0 <= x < 2^n to maximize (a XOR x) (b XOR x), returned modulo a large prime. Explain the bit-by-bit greedy that keeps the two factors as close as…
    Last asked May 2026
  • Product of array except selfCodingReturn an array where each position holds the product of every other element, without division and in linear time, using prefix and suffix products; then do it with constant extra…
    Last asked Feb 2026
  • Shortest cycle through each nodeCodingIn a weighted graph, find for every node the cost of the cheapest cycle that passes through it, or report that none exists. Only the title of this report was public; discuss the…
    Last asked Feb 2026
  • A recent innovation you deliveredBehavioralDescribe something new you recently built or introduced: the problem it solved, why your approach was new for the team, how you got it adopted, and its measurable impact.
    Last asked Dec 2025
  • Count errors in a log stream with a moving averageSystem designDesign a component that reads a continuous stream of log lines, counts errors per time window and keeps a moving average to spot spikes. Discuss windowing, memory bounds, late or…
    Last asked Dec 2025
  • Debug performance problems in a distributed systemSystem designA distributed service has become slow. Walk through how you find out why: metrics, tracing and logs, finding the slow component, common causes (hot partitions, lock contention…
    Last asked Dec 2025
  • Count pairs with 1/x + 1/y = 1/NCodingGiven a positive integer N up to about a million, count the ordered pairs of positive integers (x, y) with 1/x + 1/y = 1/N. Show that the count equals the number of divisors of…
    Last asked Nov 2025