Why am I getting WA in BYTEISLE?

I have done it as written in the editorial but i did the updation in the array in my own way.
Please see if someone can tell the mistake…

My solution link: BYTEISLE Solution of Sarthak Taneja

//