Split Batch Jobs Across K Machines With Exactly Equal Load
Last updated: November 29, 2026
Quick Overview
Given positive job durations and k identical machines, decide whether the jobs can be split into k groups whose total durations are all equal. Every job must be assigned to exactly one machine.
0
0
0 solved
Given positive job durations and k identical machines, decide whether the jobs can be split into k groups whose total durations are all equal. Every job must be assigned to exactly one machine.
A Google onsite backtracking problem framed as Borg-style batch placement. The interviewer checks early rejections (divisibility, largest job), sorting descending, and symmetry pruning so identical empty machines are not tried repeatedly.
What the Interviewer Expects
- Rejects when the total is not divisible by k or a job exceeds the target
- Sorts jobs in descending order to fail fast
- Skips trying a job on another empty bucket after it failed on one (symmetry)
- Skips buckets with the same current load as one already tried
- Mentions the bitmask DP alternative and its O(n * 2^n) cost
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 bitmask DP version.
- How would you return the actual assignment?
- What if the goal is to minimize the maximum load instead of requiring equality?
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 of positive integers
jobs(n up to about 16) and integer k >= 1. - Output: True if the jobs can be partitioned into k groups with equal sums, else False.
- Example: `[4, 3, 2, 3, 5, 2,...
High-Level Design
Let target = sum / k. Quick rejections: sum not divisible by k, or the largest job exceeds target.
Sort jobs descending, then assign each job to a bucket. For job i, try each bucket b with `load[b]...