Wildcard Pattern Matching Problem Statement
Implement a wildcard pattern matching algorithm to determine if a given wildcard pattern matches a text string completely.
The wildcard pattern may include the characters '?' and '*'.
'?' matches any single character.
'*' matches any sequence of characters, including zero characters.
Input:
The first line contains an Integer 'T', representing the number of test cases. For each test case: The first line contains a string representing the wildcard pattern. The second line contains a string representing the text.
Output:
Print 'True' if the text matches the pattern, otherwise print 'False'. Each result is printed on a new line for each test case.
Example:
Input:
T = 2
Pattern1 = "a*b?"
Text1 = "axyb"
Pattern2 = "*c"
Text2 = "abc"
Output:
True
False
Explanation:
For Pattern1 and Text1, each wildcard character matches appropriate characters, resulting in a match. For Pattern2 and Text2, there is no full match of characters leading to a 'False' result.
Constraints:
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 200
- 1 ≤ M ≤ 200
- 'TEXT' and 'PATTERN' consist only of lowercase letters and the special characters ‘*’ and ‘?’
- Time Limit: 1 second

AnswerBot
4mo
Implement a wildcard pattern matching algorithm to determine if a given wildcard pattern matches a text string completely.
Create a recursive function to match the pattern with the text character by ch...read more
Help your peers!
Add answer anonymously...
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

