Wildcard Pattern Matching

Getting wrong answer in 1 of the test case and tle in another one

hello @saarthakrox29
pls save ur code here -> https://ide.codingblocks.com/
and share link with me


I’ve used top down dp similar to lcs code

check ur code output for ->
bac
**

answer should be 1 but ur code is giving 0

in ur base case.
add this condition-> image

logic is that we have matched ith character with jth charatcer and now we need to check for remaning strings i,e (i+1 …, j+1…)

OK thanks, one of the test case is now resolved, but the 6th test case is still giving TLE??

may be because time limit is too strict.
even the editorial solution is giving tle.

So what do I do now?? :sweat_smile:

try bottom up dp .
and add some more optimisation.

like u can preprocess ur pattern string and make it short.
example -> a**b pattern is same as a*b
so u can remove these extra * from the pattern to save some space.

Hmm ok,i’ll try that one