slots1
and slots2
by their start times.pointer1
and pointer2
to 0.pointer1
is less than the length of slots1
and pointer2
is less than the length of slots2
:
a. Calculate the overlap start time as the maximum of slots1[pointer1][0]
and slots2[pointer2][0]
.
b. Calculate the overlap end time as the minimum of slots1[pointer1][1]
and slots2[pointer2][1]
.
c. If the overlap duration is at least duration
, return [overlap start time, overlap start time + duration]
.
d. If slots1[pointer1][1]
is less than slots2[pointer2][1]
, increment pointer1
. Otherwise, increment pointer2
.