1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-30 12:10:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/驼峰式匹配 [camelcase-matching].html

45 lines
2.0 KiB
HTML
Raw Normal View History

2023-12-09 18:42:21 +08:00
<p>给你一个字符串数组 <code>queries</code>,和一个表示模式的字符串&nbsp;<code>pattern</code>,请你返回一个布尔数组 <code>answer</code> 。只有在待查项&nbsp;<code>queries[i]</code> 与模式串&nbsp;<code>pattern</code> 匹配时,&nbsp;<code>answer[i]</code>&nbsp;才为 <code>true</code>,否则为 <code>false</code></p>
2022-03-27 20:46:41 +08:00
2023-12-09 18:42:21 +08:00
<p>如果可以将<strong>小写字母</strong>插入模式串&nbsp;<code>pattern</code>&nbsp;得到待查询项&nbsp;<code>query</code>,那么待查询项与给定模式串匹配。可以在任何位置插入每个字符,也可以不插入字符。</p>
2022-03-27 20:46:41 +08:00
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
2023-12-09 18:42:21 +08:00
<pre>
<strong>输入:</strong>queries = ["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"], pattern = "FB"
2022-03-27 20:46:41 +08:00
<strong>输出:</strong>[true,false,true,true,false]
<strong>示例:</strong>
2023-12-09 18:42:21 +08:00
"FooBar" 可以这样生成:"F" + "oo" + "B" + "ar"。
"FootBall" 可以这样生成:"F" + "oot" + "B" + "all".
"FrameBuffer" 可以这样生成:"F" + "rame" + "B" + "uffer".</pre>
2022-03-27 20:46:41 +08:00
<p><strong>示例 2</strong></p>
2023-12-09 18:42:21 +08:00
<pre>
<strong>输入:</strong>queries = ["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"], pattern = "FoBa"
2022-03-27 20:46:41 +08:00
<strong>输出:</strong>[true,false,true,false,false]
<strong>解释:</strong>
2023-12-09 18:42:21 +08:00
"FooBar" 可以这样生成:"Fo" + "o" + "Ba" + "r".
"FootBall" 可以这样生成:"Fo" + "ot" + "Ba" + "ll".
2022-03-27 20:46:41 +08:00
</pre>
<p><strong>示例 3</strong></p>
2023-12-09 18:42:21 +08:00
<pre>
<strong>输入:</strong>queries = ["FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"], pattern = "FoBaT"
<strong>输出:</strong>[false,true,false,false,false]
2022-03-27 20:46:41 +08:00
<strong>解释: </strong>
2023-12-09 18:42:21 +08:00
"FooBarTest" 可以这样生成:"Fo" + "o" + "Ba" + "r" + "T" + "est".
2022-03-27 20:46:41 +08:00
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
2023-12-09 18:42:21 +08:00
<ul>
<li><code>1 &lt;= pattern.length, queries.length &lt;= 100</code></li>
2022-03-27 20:46:41 +08:00
<li><code>1 &lt;= queries[i].length &lt;= 100</code></li>
2023-12-09 18:42:21 +08:00
<li><code>queries[i]</code><code>pattern</code> 由英文字母组成</li>
</ul>