Assign Build Jobs to K Workers to Minimize the Longest Finish Time
Last updated: November 29, 2026
Quick Overview
Given build job durations and k workers, assign every job to one worker so that the maximum total time any worker spends is as small as possible. Return that minimum possible maximum.
0
0
0 solved
Given build job durations and k workers, assign every job to one worker so that the maximum total time any worker spends is as small as possible. Return that minimum possible maximum.
A Google onsite problem in the style of the internal build system scheduling story. The interviewer is checking branch and bound: carrying the best answer found so far, pruning any branch that already exceeds it, and breaking symmetry among workers.
What the Interviewer Expects
- Uses branch and bound with the current best as the pruning bound
- Sorts jobs descending to find a good bound early
- Breaks symmetry by not trying a second empty worker
- Seeds the bound with a greedy (LPT) assignment
- Mentions binary search on the answer plus feasibility as an alternative
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Implement the binary-search-on-answer version with a feasibility backtracker.
- How close is the greedy longest-processing-time heuristic to optimal?
- How would you handle jobs with dependencies?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: list
jobsof positive durations (n up to about 12) and integer k (1 <= k <= n). - Output: the minimum achievable value of the maximum worker load.
- Example:
[1, 2, 4, 7, 8], k = 2 gives ...
High-Level Design
Branch and bound over job assignments:
- Sort jobs descending.
- Seed
bestwith a greedy longest-processing-time assignment (each job to the currently lightest worker). That gives a tight startin...