Hi,
Please explain the problem again.
Why we are ignoring the first initial of word1 ?
It might be the case the minimum distance will come considering that initial distance?
thanks
Problem Explanation doubt
hello @vatsal50
see if we are at index i and it has w1 then we need last index of w2 right?
now before going to next index i+1 , we should update index of w1 to i , becuase it will be nearest to any of these indices [i+1…n-1] (i.e whenever we find w2 , we would like to compute its distance from i and not from previous index ) right?
that is why we are updating indices i.e discarding previous index and updating to current index.
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.