Question DSA-GRDY-0013
MediumWhat is the output of this code?
arr = [900, 940, 950, 1100]
dep = [910, 1200, 1120, 1130]
arr.sort(); dep.sort()
i = j = cur = best = 0
while i < len(arr):
if arr[i] <= dep[j]:
cur += 1; i += 1
else:
cur -= 1; j += 1
best = max(best, cur)
print(best)
- A.
4
- B.
3
- C.
Sign up free to see the answer and a step-by-step explanation.