Code doesn't work with different array


The code works with the array that is in the course but if i keep 88 at 0 index then it doesn’t works. what’s wrong with it ?

hi @ayushnarang2222
Please check the comment in the below code.

Okay, but what is the reason of not working and then working with this change ?

J<=0 was written after arr[j] statement … so when j=-1 it checks value of j after it checks the value of arr[j] and j being -1 is out of scope for the array…
i have mentioned this as a comment in code where error is …

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.