Doubt in the solution

can you please explain why are we doing n-i-1 and how are the loops working

@mohammednomaan45 if you are at the ith index, you need to compare with only the elements present on the right side, ie n-i+1 elements are remaining on the right side

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.