Pick the fix
Your greedy rule for picking non-clashing bookings sorts by length (shortest first). Which input breaks it?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A [1, 5), [4, 7), [6, 10): the shortest one blocks both others
Right: earliest end keeps two, shortest-first keeps one.
One counterexample is enough to reject a greedy rule, which is why testing tiny cases is part of the method.
Why not the others?
- B [1, 2), [3, 4), [5, 6): no clashes at all. Every rule keeps all three here.
- C A single booking. One booking is trivial for any rule.