mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 06:51:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,56 +1,47 @@
|
||||
<p>给定一个字符串 (<code>s</code>) 和一个字符模式 (<code>p</code>) ,实现一个支持 <code>'?'</code> 和 <code>'*'</code> 的通配符匹配。</p>
|
||||
|
||||
<pre>'?' 可以匹配任何单个字符。
|
||||
'*' 可以匹配任意字符串(包括空字符串)。
|
||||
</pre>
|
||||
|
||||
<p>两个字符串<strong>完全匹配</strong>才算匹配成功。</p>
|
||||
|
||||
<p><strong>说明:</strong></p>
|
||||
<div class="title__3Vvk">给你一个输入字符串 (<code>s</code>) 和一个字符模式 (<code>p</code>) ,请你实现一个支持 <code>'?'</code> 和 <code>'*'</code> 匹配规则的通配符匹配:</div>
|
||||
|
||||
<ul>
|
||||
<li><code>s</code> 可能为空,且只包含从 <code>a-z</code> 的小写字母。</li>
|
||||
<li><code>p</code> 可能为空,且只包含从 <code>a-z</code> 的小写字母,以及字符 <code>?</code> 和 <code>*</code>。</li>
|
||||
<li class="title__3Vvk"><code>'?'</code> 可以匹配任何单个字符。</li>
|
||||
<li class="title__3Vvk"><code>'*'</code> 可以匹配任意字符序列(包括空字符序列)。</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<div class="original__bRMd">
|
||||
<div>
|
||||
<p>判定匹配成功的充要条件是:字符模式必须能够 <strong>完全匹配</strong> 输入字符串(而不是部分匹配)。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<pre><strong>输入:</strong>
|
||||
s = "aa"
|
||||
p = "a"
|
||||
<strong>输出:</strong> false
|
||||
<strong>解释:</strong> "a" 无法匹配 "aa" 整个字符串。</pre>
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong>
|
||||
s = "aa"
|
||||
p = "*"
|
||||
<strong>输出:</strong> true
|
||||
<strong>解释:</strong> '*' 可以匹配任意字符串。
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "aa", p = "a"
|
||||
<strong>输出:</strong>false
|
||||
<strong>解释:</strong>"a" 无法匹配 "aa" 整个字符串。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong>
|
||||
s = "cb"
|
||||
p = "?a"
|
||||
<strong>输出:</strong> false
|
||||
<strong>解释:</strong> '?' 可以匹配 'c', 但第二个 'a' 无法匹配 'b'。
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "aa", p = "*"
|
||||
<strong>输出:</strong>true
|
||||
<strong>解释:</strong>'*' 可以匹配任意字符串。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 4:</strong></p>
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre><strong>输入:</strong>
|
||||
s = "adceb"
|
||||
p = "*a*b"
|
||||
<strong>输出:</strong> true
|
||||
<strong>解释:</strong> 第一个 '*' 可以匹配空字符串, 第二个 '*' 可以匹配字符串 "dce".
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "cb", p = "?a"
|
||||
<strong>输出:</strong>false
|
||||
<strong>解释:</strong>'?' 可以匹配 'c', 但第二个 'a' 无法匹配 'b'。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 5:</strong></p>
|
||||
<p> </p>
|
||||
|
||||
<pre><strong>输入:</strong>
|
||||
s = "acdcb"
|
||||
p = "a*c?b"
|
||||
<strong>输出:</strong> false</pre>
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>0 <= s.length, p.length <= 2000</code></li>
|
||||
<li><code>s</code> 仅由小写英文字母组成</li>
|
||||
<li><code>p</code> 仅由小写英文字母、<code>'?'</code> 或 <code>'*'</code> 组成</li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user