Minimum Wall Clock Time to Build a Visual Studio Solution

Last updated: November 29, 2026

Quick Overview

Each project in a Visual Studio solution has a compile time and a list of projects it depends on. With unlimited parallel build agents, a project can start once all its dependencies finish. Return the minimum total time to build everything, or -1 if the dependencies contain a cycle.

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

0

0

0 solved


Each project in a Visual Studio solution has a compile time and a list of projects it depends on. With unlimited parallel build agents, a project can start once all its dependencies finish. Return the minimum total time to build everything, or -1 if the dependencies contain a cycle.

A topological sort question in the style of Microsoft onsites, framed around MSBuild parallel builds. The interviewer checks that you see the answer as the critical path (longest weighted path in a DAG), compute it during Kahn's algorithm, and detect cycles.

What the Interviewer Expects
  • Model projects as a DAG with edges from dependency to dependent
  • Recognize the answer is the longest weighted path
  • Compute earliest finish times in topological order
  • Detect cycles when not all nodes are processed
  • Explain why unlimited agents make this a pure DAG problem
Key Topics to Cover
topological sort
critical path
DAG
dynamic programming
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 does the problem change with only P build agents?
  • How would you report the critical path itself?
  • How would you make incremental builds recompute only affected projects?
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: times[i] for projects 0..n-1 and deps, a list of pairs (a, b) meaning a must finish before b starts. Output: earliest time when every project is done, or -1 on a cycle. Unlimited parallel...

High-Level Design

Run Kahn's algorithm. finish[v] starts as times[v] for projects with no dependencies. When we pop a project u from the ready queue, for each dependent v we update `start[v] = max(start[v], fin...


Submit Your Answer
Markdown supported