A catalogue of ways to attack a problem. Its greedy panel says the rule out loud: take the locally best choice, never look back, and prove the choice safe. This clinic is that proof, done once by hand on a real problem.
Before you start.Clinic #28: Merge Intervals took a pile of road closures, sorted them by where they start, and walked the road once, widening one sign at a time. If you have not read it, the one thing to carry over is that an interval is a start and an end, like “km 2 to km 6”. Sorting costs a little more than one pass, written O(n log n), and trying every subset of n things costs O(2ⁿ), which doubles with each item you add; Sorting & Searching shows where the first one comes from.
Lesson 68 of 96 in DSA
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.