Algorithms Playbook
← All problems
MediumGreedy →Similar to: Non-overlapping Intervals

Most meetings in one room

Problem

Given meetings as [start, end) pairs, return the maximum number of meetings you can attend in a single room if no two may overlap. A meeting that starts exactly when another ends is fine.

Examples

Input: [[1,3],[2,4],[3,5],[0,6],[5,7]]

Output: 3

[1,3], [3,5], [5,7].

Input: [[1,2],[1,2],[1,2]]

Output: 1

Hints

    Try it first. Every hint reveals a bit more.

    Solution