Problem Statement
Each element of the String[] meetings gives the start and end time of a meeting, separated by a single space. Each time is given in the form hh:mm and represents a time between 08:00 in the morning and 08:00 in the evening inclusive.
Create a class Conference that contains a method coverage that is given n, the number of faculty sent to the conference, and the String[] meetings listing the times of all the meetings. The method returns the most meetings that we can cover by having at least one faculty member at the meeting from start to end.
Definition
- Class:
- Conference
- Method:
- coverage
- Parameters:
- int, String[]
- Returns:
- int
- Method signature:
- int coverage(int n, String[] meetings)
- (be sure your method is public)
Constraints
- n will be between 1 and 10, inclusive.
- meetings will contain between 1 and 50 elements, inclusive.
- Each element of meetings will contain 11 characters in the form "hh:mm hh:mm"
- Each hh:mm will represent a time between 8 am and 8 pm inclusive.
- Each mm will be between 00 and 59, inclusive.
- In each element of meetings the second time will be strictly later than the first.
Examples
3
{"08:00 08:00","08:00 08:00","08:00 08:00", "08:00 08:00","08:00 08:00"}Returns: 3
All these meetings last all day long. Nobody can cover more than one.2
{"09:00 08:00","08:00 12:00","12:00 08:00", "08:00 08:00","08:00 08:00"}Returns: 3
One person can cover the 8-12 meeting and the 12-8 meeting. The other person can cover one of the all-day meetings.1
{"08:00 01:00","08:25 12:50","12:00 12:30", "12:30 08:00","08:00 08:00"}Returns: 2