Question DSA-GRDY-0018
HardWhat is the output of this code?
pts = sorted([[10, 16], [2, 8], [1, 6], [7, 12]], key=lambda p: p[1])
arrows, end = 0, float('-inf')
for s, e in pts:
if s > end:
arrows += 1
end = e
print(arrows)
- A.
1
- B.
3
- C.
Sign up free to see the answer and a step-by-step explanation.