Class Solution
java.lang.Object
g0001_0100.s0044_wildcard_matching.Solution
44 - Wildcard Matching.<p>Hard</p>
<p>Given an input string (<code>s</code>) and a pattern (<code>p</code>), implement wildcard pattern matching with support for <code>'?'</code> and <code>'*'</code> where:</p>
<ul>
<li><code>'?'</code> Matches any single character.</li>
<li><code>'*'</code> Matches any sequence of characters (including the empty sequence).</li>
</ul>
<p>The matching should cover the <strong>entire</strong> input string (not partial).</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “aa”, p = “a”</p>
<p><strong>Output:</strong> false</p>
<p><strong>Explanation:</strong> “a” does not match the entire string “aa”.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “aa”, p = “*”</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> ‘*’ matches any sequence.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> s = “cb”, p = “?a”</p>
<p><strong>Output:</strong> false</p>
<p><strong>Explanation:</strong> ‘?’ matches ‘c’, but the second letter is ‘a’, which does not match ‘b’.</p>
<p><strong>Example 4:</strong></p>
<p><strong>Input:</strong> s = “adceb”, p = “*a*b”</p>
<p><strong>Output:</strong> true</p>
<p><strong>Explanation:</strong> The first ‘*’ matches the empty sequence, while the second ‘*’ matches the substring “dce”.</p>
<p><strong>Example 5:</strong></p>
<p><strong>Input:</strong> s = “acdcb”, p = “a*c?b”</p>
<p><strong>Output:</strong> false</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>0 <= s.length, p.length <= 2000</code></li>
<li><code>s</code> contains only lowercase English letters.</li>
<li><code>p</code> contains only lowercase English letters, <code>'?'</code> or <code>'*'</code>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
isMatch
-