Run error while submitting solution

In above problem when I am running testcase it is showing correct output but i am submitting it is showing run error !!

link to my solution :

hi @vishaaltiwari1999

have you take a look at constraints

Constraints

1<=N<=2*10^5

array size is large
but in you code you have take only 100 size array

change the size of array to 200000
you code will pass all testcases

i hope this helps

if your doubt is resolved
please mark it as resolved form doubts section in your course