Minimum Time to Run Azure DevOps Jobs With Same-Type Cooldown

Last updated: November 29, 2026

Quick Overview

An Azure DevOps agent runs one job per tick, and two jobs of the same type must be separated by at least `cooldown` ticks. Given the list of job types, return the minimum number of ticks (including idle ticks) needed to run them all.

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

0

0

0 solved


An Azure DevOps agent runs one job per tick, and two jobs of the same type must be separated by at least `cooldown` ticks. Given the list of job types, return the minimum number of ticks (including idle ticks) needed to run them all.

Microsoft onsite coding rounds like scheduling problems tied to build and release pipelines. The interviewer looks for the counting insight that avoids simulating every tick, and for a clean justification of the formula.

What the Interviewer Expects
  • Identify that the most frequent job type dictates the schedule's skeleton
  • Derive the frame formula (max_count - 1) * (cooldown + 1) + tied
  • Explain why the answer is at least the number of jobs
  • Offer a heap based simulation as a fallback and compare
  • Verify on an example with and without idle ticks
Key Topics to Cover
greedy
counting
task scheduling
heap
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 output an actual schedule, not just its length?
  • What if the order of jobs is fixed and you can only insert idles?
  • What if there are k agents running in parallel?
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: list of job type labels and a non-negative integer cooldown.
  • Jobs can run in any order; each takes one tick.
  • Same-type jobs need at least cooldown ticks between them.
  • Output: minimu...
High-Level Design

Let the most frequent type appear max_count times. Those copies must be spaced into max_count - 1 gaps of width cooldown + 1, plus a final slot. Lay them out as frames: each frame starts with on...


Submit Your Answer
Markdown supported