if patt . charAt ( i ) is found in ' str ' , check if it has the minimum index or not . If yes , then update ' minIndex ' and break
if ( patt [ i ] == str [ j ] && j < minIndex ) { minIndex = j ; break ; } } }