Run time error is coming

I have used 4 pointer formula and its not working. run time error is coming

Hello @mittali your corrected code;

@mittali i have shared the code above you can check that;

if we dont use this if(rs<re) condition then 53 or 35 doesnt work

@mittali then you have to do like this:

why we have used break before that condition. please explain me the updated code

See not using that will print some elements which are already visited. So to stop thay we will break if we have already printed the total number of elements.

how it will visit those elements if we have applied that condition. there is no point of applying break before last 2 conditions

Try after removing that break statement.
You will see the output thay 2 elements will be repeated.

The code which I wrote. its giving warning why?

its showing time limit exceed

Because in your code you have not used equal to in both the ID conditions and because of that you while loop was not terminating and that eventually end up giving error.

can you tell me why we are putting equal to in if conditions. because we want it not to repeat

Because rc<=ee that is also valid case and if you will miss that then your I will not be equal to total and it will give time limit exceeded because loop will not terminate.

Thank you. I got it this.

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.