Problem · Intervals
Meeting Assistant
Learn this problemProblem statement
Implement a simple meeting assistant. A list of strings, events[n], in the form
"<person_name> <action> <start> <end>" is provided where
person_name performs action from start to end,
both inclusive. Times are formatted HH:MM. Find the earliest time in the day, from "00:00" to "23:59",
when all people mentioned in at least one event are available for a meeting of k minutes.
Report the answer as "HH:MM" or the string "-1" if it is not possible.
Function
getEarliestMeetTime(events: String[], k: int) → String
Complete the function getEarliestMeetTime in the editor below.
getEarliestMeetTime takes the following arguments:
- 1.
String events[n]: event descriptors - 2.
int k: meeting duration
Returns
string: the earliest time for the meeting or "-1" if it is not possible
Examples
Example 1
events = ["Alex sleep 00:00 08:00", "Sam sleep 07:00 13:00", "Alex lunch 12:30 13:59"]k = 60return = "14:00"Alex is not available until 8:00. After that, Sam is not available until 13:00. Then Alex is busy until 13:59.
Return the earliest time they are both available, "14:00".
Example 2
events = ["sam sleep 12:00 23:59", "alex sleep 00:00 13:00"]k = 1return = "-1"There is no time when both are free. 😞
Example 3
events = ["sam sleep 12:00 18:59", "alex gaming 00:00 11:00"]k = 60return = "19:00"Alex plays games from 00:00 until 11:00. If the meeting starts at 11:01, it ends at 12:01. Sam is asleep from 12:00 to 18:59.
Constraints
More Snowflake problems
- Closest Target CharacterPHONE SCREEN · Seen Jul 2026
- Horizontal Pod AutoscalerSeen Jul 2026
- Minimum HeightOA · Seen Jul 2026
- Vowel SubstringSeen Jun 2026
- String Formation (Also for AI/ML Software Engineer Intern :)OA · Seen Jun 2026
- Efficient DeploymentsOA · Seen Jun 2026
- Character Frequencies Across Nested String ListsPHONE SCREEN · Seen Jun 2026
- Character Frequencies Across StringsPHONE SCREEN · Seen Jun 2026