Verify a Release Order Is Uniquely Implied by Partial Change Logs

Last updated: November 29, 2026

Quick Overview

Given a proposed full release order of build numbers 1..n and a list of partial change logs (each an ordered subsequence), decide whether the proposed order is the only order consistent with every log.

Microsoft
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given a proposed full release order of build numbers 1..n and a list of partial change logs (each an ordered subsequence), decide whether the proposed order is the only order consistent with every log.

A harder topological sort question in the style of Microsoft onsites, framed around reconstructing Windows Insider build order from team change logs. The interviewer checks that you recognize uniqueness means the ready queue never holds more than one node, and that you validate the result matches the proposed order.

What the Interviewer Expects
  • Build edges from consecutive pairs in each log
  • Validate that every number in logs is in range
  • Run Kahn's algorithm and require exactly one ready node at each step
  • Compare the produced order to the proposed order
  • Explain why uniqueness equals a Hamiltonian path in the DAG
Key Topics to Cover
topological sort
uniqueness
DAG
Hamiltonian path
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you list every element whose position is ambiguous?
  • What if the logs could contain contradictions and you must report one?
  • How would you compute this incrementally as logs arrive?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: order, a permutation of 1..n, and logs, a list of lists of integers. Output: True if order is a valid topological order for the constraints in logs and no other valid order exists. Number...

High-Level Design

Each log [x1, x2, ..., xk] implies edges x1 -> x2 -> ... -> xk; only consecutive pairs are needed because transitivity covers the rest. A topological order is unique exactly when, during Kahn's al...


Submit Your Answer
Markdown supported