Question DSA-DP-0061
HardWhat is the output of this code?
def lis_len(a):
import bisect
tails = []
for x in a:
i = bisect.bisect_left(tails, x)
if i == len(tails): tails.append(x)
else: tails[i] = x
return len(tails), tails
print(lis_len([3, 10, 2, 1, 20, 4, 6, 7]))
- A.
(4, [1, 4, 6, 7])
- B.
(3, [1, 4, 6])
- C.
Sign up free to see the answer and a step-by-step explanation.