The Find Minimum Time to Finish All Jobs interview question is a complex resource allocation problem. You are given an array of jobs, where each value represents the time required to complete that job, and an integer representing the number of workers. You must assign every job to exactly one worker such that the "makespan"—the maximum time any single worker spends working—is minimized. This Find Minimum Time to Finish All Jobs coding problem is a classic variation of the multi-processor scheduling problem.
Companies like Microsoft and Meta ask this to evaluate a candidate's mastery of Backtracking and Dynamic Programming with optimizations. Since this is an NP-hard problem, the interview focuses on how you prune the search space. It tests your ability to implement "Backtracking interview patterns" and optimize them using techniques like symmetry breaking and state-space reduction.
This problem is typically solved using Backtracking with Pruning or Dynamic Programming with Bitmask.
dp[i][mask] represents the minimum makespan using i workers to complete jobs represented by the bitmask mask.Jobs: [3, 2, 3], .
[3, 3], Worker 2 gets [2]. Max time: 6.[3, 2], Worker 2 gets [3]. Max time: 5.
The minimum time to finish all jobs is 5.Practice "Symmetry Breaking" in recursion. If you have identical workers, assigning a job to worker A is exactly the same as assigning it to worker B if both are currently idle. This simple check is often the difference between a TLE and a passing solution.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Optimal Account Balancing | Hard | Solve | |
| Matchsticks to Square | Medium | Solve | |
| Fair Distribution of Cookies | Medium | Solve | |
| Maximum Compatibility Score Sum | Medium | Solve | |
| Minimum Number of Work Sessions to Finish the Tasks | Medium | Solve |