Showing runtime error please help

Hey @Jun18APP0112 I increased the size of s from 1000 to 1005 to avoid segmentation fault and changed the line 17 of your code. Please take a look https://ide.codingblocks.com/s/186089

If you don’t have any further queries please mark the doubt as resolved.

sir, why it is showing runtime while taking l-1 in line 17 please help

it could show some wrong results

No because its resulting in segmentation fault because in your move() ,you only mentioned the condition for i==l-1 ,but what about the case when i exceeds l-1 (it does ,dry run your code), so need to add
if(i>=l-1) return;
then your code works fine.
If you don’t have any further queries please mark the doubt as resolved.

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.