← 返回 scale.ai 的题目列表Task Scheduling to Minimize Overall Completion Deadline (with Dependencies and Heap Optimization)
类型:online_judge
Problem: Task Scheduling (Incremental Constraints)
You are given a set of tasks, each with a processing time. Your goal is to compute the minimum total time to finish all tasks (i.e., the time when the last task completes / overall deadline / makespan). The interview problem is split into three parts with increasing constraints.
Note: The original post does not include the exact input schema and I/O format. The following is a faithful summary of the core requirements: minimize overall finishing time, add prerequisite constraints, and optimize using a heap.
Part 1: Scheduling Without Constraints
Input: a list of tasks with their durations.
Constraints: no prerequisites or additional restrictions.
Output: the minimum total time required to complete all tasks (the finishing time of the last task).
Part 2: Add Subtask/Prerequisite Dependencies
Input:
tasks with durations.
dependency relations: some tasks can only start after all their prerequisites are completed.
Constraints: a task becomes "ready" only when all prerequisites are satisfied.
Requirement: you may maintain a separate list/set of currently ready tasks and schedule from it.
Output: the minimum total completion time under dependency constraints.
Part 3: Data Structure / Time Optimization
Based on Part 2:
optimize the solution for performance.
typical approach: use a heap/priority queue to maintain ready tasks and reduce selection overhead.
Test Cases
The original post contains no concrete I/O format or sample cases, so no runnable test cases are provided to avoid making incorrect assumptions.