Skip to content
Back to libraryPart 2 · Core techniques

2.5Greedy methods

Before you start

It helps to have read 1.5 Sorting. Overall level: Core.

Practice: Greedy methods

0 of 4 solved

About these problems

Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.

  1. 1Compatible sessionsChoose as many sessions as possible so that no chosen time intervals overlap. A session occupies [s, e); one ending at time t is compatible with one starting at t.ApplyNot started
  2. 2Two-seat boatsEach boat carries at most two people with total weight at most w. Find the minimum boats needed. Every person individually fits.ConnectNot started
  3. 3Covered timeFind the total length covered by the union of n half-open time intervals. Overlaps count only once.ReasonNot started
  4. 4Meeting coordinateChoose an integer x minimizing sum |a_i-x|. Print the minimum sum; you do not need to print x.StretchNot started

Read the lesson