Maximum length character | window sliding

this code is copied form lecture but isme mere ko 2 statement samaj nii ayi

line 17 m : i-curr_len>last_occ
and line 23
ye staement kyu likhi h kya significance h inki ??

Hi Anuj…
so in line 17 we are checking that (last_occ == -1 || i-curr_len>last_occ) this means either the character is occurring for the first time (last_occ == -1) ie it has not occurred till now…
i-curr_len>last_occ means this character might have occured previously but it was not in current answers range.
In line 23 we are finding the current length of substring ( curr_len = i-last_occ ) so i here is the current position and last_occ indicates the postion where the same character occured last

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.