Practice Wildcard Matching
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Return whether pattern p matches the entire string s. A question mark (?) matches exactly one character. An asterisk (*) matches any sequence of characters, including an empty sequence. Every other pattern character must match the corresponding literal character. A match that covers only part of s is not sufficient.
Source: Wildcard Matching on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "aa", p = "a"
Output
false
# Example 2
Input
s = "aa", p = "*"
Output
true
# Example 3
Input
s = "cb", p = "?a"
Output
false
Constraints
0 <= s.length, p.length <= 2000
s contains only lowercase English letters.
p contains only lowercase English letters, '?' or '*'.
Related LeetCode Problems
Practice more problems similar to Wildcard Matching.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.