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