Greedy & Intervals Checkpoint

Trace fresh cases, diagnose a failed invariant, then revisit the linked explanation and implementation.


Get every question correct to pass this checkpoint. You can review feedback, revise your answers, and submit again.

1. For half-open intervals [0,2), [1,4), [2,3), [3,5), how many can be scheduled without overlap? Answer with the integer only.
2. Why can choosing the earliest-finishing compatible interval preserve an optimal schedule?

Select one answer.

3. Optimal merge cost for file sizes [2,3,8] is what? Answer with the integer only.
4. For minimum total pairwise merge cost, why repeatedly merge the two smallest current pieces?

Select one answer.

5. An interval scheduler switches from half-open intervals to closed intervals. Which compatibility check changes?

Select one answer.

6. Intervals [0,2) and [2,5) each pay 3; [0,5) pays 10. Does earliest-finish maximize profit?

Select one answer.

Join Discord