Question DSA-GRDY-0008
MediumWhat is the output of this code?
acts = [(1, 3), (2, 5), (3, 5), (4, 6), (5, 7)]
acts.sort(key=lambda a: a[1])
end, n = 0, 0
for s, f in acts:
if s >= end:
n += 1
end = f
print(n)
- A.
5
- B.
2
- C.
Sign up free to see the answer and a step-by-step explanation.