(Solved) James is a businessman. He is on a tight schedule this week. The week starts on Monday at 00:00 and ends on Sunday at 24:00

James is a businessman. He is on a tight schedule this week. The week starts on Monday at 00:00 and ends on Sunday at 24:00. His schedule consists of M meetings he needs to take part in. Each of them will take place in a period of time, beginning and ending on the same day (there are no two ongoing meetings at the same time). James is very tired, thus he needs to find the longest possible time slot to sleep. In other words, he wants to find the longest period of time when there are no ongoing meetings. The sleeping break can begin and end on different days and should begin and end in the same week. You are given a string containing M lines. Each line is a substring representing one meeting in the schedule, in the format “Ddd hh:mm-hh: mm”. “Ddd” is a three-letter abbreviation for the day of the week when the meeting takes place: “Mon” (Monday), “Tue”, “Wed”, “Thu”, “Fri”, “Sat”, “Sun” hh :mm-hh: mm” means the beginning time and the ending time of the meeting (from 00:00 to 24:00 inclusive) The given times represent exact moments of time. So, there are exactly five minutes between 13:40 and 13:45.

James is a businessman. He is on a tight schedule this week. The week starts on Monday at 00:00 and ends on Sunday at 24:00.

Task For example, given a string: Sun 10:00-20:00 Fri 05:00-10:00 Fri 16:30-23:50 Sat 10:00-24:00 Sun 01:00-04:00 Sat 02:00-

Task the longest time slot when James can sleep is 505 minutes, since James can sleep from Tuesday 20:00 to Wednesday 04:25,

Assume that: . O Mis an integer within the range [1..100); Each line of the input string is in the format Ddd hh:mm-hh:mm a

Expert Answer


Answer to James is a businessman. He is on a tight schedule this week. The week starts on Monday at 00:00 and ends on Sunday at 24:00….

OR
Order Now
×

Powered by WhatsApp Chat

× How can I help you?