def max_logged_in(interval_lst,T):
startArr, endArr = zip(*interval_lst)
i = 0
j = 0
maxOverlap = 0
currentOverlap = 0
while (i<T and j<T):
if (startArr[i] < endArr[j]):
currentOverlap = currentOverlap + 1
maxOverlap = max(maxOverlap, currentOverlap)
i = i + 1
else:
currentOverlap = currentOverlap - 1
j = j + 1
The code is supposed to run through the two arrays and find the max overlap give a list such as [(5,15), (18,25), (3,12), (4, 11), (1,15), (18,19)] in the given time (T).
Running this code is giving me a tuple index error. I can't seem to figure out why it is giving me an index error.
T> 5, then yourifwill cause the error you got.T?