Current characters are considered as matching in two cases ( a ) current character of pattern is ' ? ' ( b ) characters actually match
else if ( pattern . charAt ( j - 1 ) == ' ? ' || str . charAt ( i - 1 ) == pattern . charAt ( j - 1 ) ) lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] ;