Question DSA-GRDY-0011
MediumWhat is the output of this code?
a = [2, 3, 1, 1, 4]
reach = 0
for i, x in enumerate(a):
if i > reach:
break
reach = max(reach, i + x)
print(reach >= len(a) - 1)
- A.
False
- B.
Error
- C.
Sign up free to see the answer and a step-by-step explanation.