Unable to clear all testcases


What’s wrong with my code?


its passing all the test cases

Why does it not work with n = 1000009 but works with n = 1000005

it works with n = 1000009 also. mistake was here
image
loop will run till n and not less than n and line 42 was wrong(line 42 should be removed)

but a[n] does not exist right?

elements of a are line 0, 1, 2, 3-----------, n-1;

why?? it exists na then only u are computing

image
see the constarints… it is <= and not <

i have taken size of array 1000009 which already contains 1000000

to bhai line 42 nikal do… vo kis basis pe likha hai?? code will still run fine… dikkat line 42 ki hai

still doesn’t work sir

yrr corrected code bheja to hai… use dekho na

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.