Feature #7: Longest Busy Period

Implementing the "Longest Busy Period" feature for our "Google Calendar" project.

Description

A person has divided their workday into 15-minute time slots numbered as 1, 2, 3, ... n. People who want to schedule a meeting with this person choose any available time slot that suits them. Assume that this person’s calendar is now filled with jumbled up numbers that represent the time slots reserved for meetings. Our task is to find out what the longest consecutive time period in which this person will be busy is.

The following illustration shows how we will be mapping the 15-minute time slots to the numbers given in the input:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.