Question
Write a function get_max_overlap(events) that returns the two events in the events table(below) with the maximum overlap and their overlap time. Note that it does
Write a function get_max_overlap(events) that returns the two events in the events table(below) with the maximum overlap and their overlap time. Note that it does NOT have to be consecutive events. If there is more than one occurrence of the maximum overlap time, the function should return the details of the first occurrence. If none of the given events overlaps the function should return None.
events = [['A',0,3],['B',4,6],['C',8,14],['D',9,11],['E',10,16],['F',12,18]]
The helper function, get_overLap( event, event2) is provided to you (see below). You may use this function in your implementation of the get_max_overlap(events) function.
def get overlap (event1, event2): ""\| Inputs: two overlapping events, where event1 starts before event2 Output: overlap time between the two events "\|" if event2 [2] return event2 [2] - event2 [1] else: return (event2 [2]-event1 [1])-(event2 [1]-event1 [1]) - (event2 [2]-event1 [2])
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started