Question DSA-SORT-0045
MediumWhat is the output of this code?
a = [4, 2, 2, 8, 3, 3, 1]
c = [0] * (max(a) + 1)
for x in a:
c[x] += 1
for i in range(1, len(c)):
c[i] += c[i - 1]
print(c[3], c[8])
- A.
5 8
- B.
4 7
- C.
Sign up free to see the answer and a step-by-step explanation.