Given two strings ‘str’ and a wildcard pattern ‘pattern’ of length N and M respectively, You have to print ‘1’ if the wildcard pattern is matched with str else print ‘0’ .
The wildcard pattern can include the characters
?
and*
?
– matches any single character*
– Matches any sequence of characters (including the empty sequence)Note: The matching should cover the entire str (not partial str).
- Time : O(nm)
- Space : O(nm)
c++
1 | class Solution { |