Code seems perfectly fine but still cases are not passing

I solved it manually on paper its giving correct output but in editor it is sowing error.
Kindly help me in rectifying the code:

hey, refer this–>

I dont know how to use vectors I am just doing an assignment of 1 D array

If possible please suggest what changes need to be done in my code only

hey, vector is just similar to array… u can replace vector with array… rest logic remains the same…

Sir I dont now how to use vectors as I have not reached to that topic

hey, sry for delayed response… I have replaced vector with array


Hope it clears ur doubt:)

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.

how will it come to mind to use v[i-x+n] in line 25…how to figure it out ?