Doubt in subarray with distint elements

I’ve referred this code from discussion. My doubt is why we are not doing j=0 in line 24 after while loop? I mean, after first iteration won’t j be equal to 3 for every iteration? The while loop will not even work from 2nd iteration.

Please help me out with this.

Hello @gambhirrahul0 could you please confirm again where you are talking in line24 there is brace but not any loop.

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.