mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-01 21:03:27 +08:00
国外版
This commit is contained in:
33
算法题(国外版)/number-of-matching-subsequences.html
Normal file
33
算法题(国外版)/number-of-matching-subsequences.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<p>Given a string <code>s</code> and an array of strings <code>words</code>, return <em>the number of</em> <code>words[i]</code> <em>that is a subsequence of</em> <code>s</code>.</p>
|
||||
|
||||
<p>A <strong>subsequence</strong> of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.</p>
|
||||
|
||||
<ul>
|
||||
<li>For example, <code>"ace"</code> is a subsequence of <code>"abcde"</code>.</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abcde", words = ["a","bb","acd","ace"]
|
||||
<strong>Output:</strong> 3
|
||||
<strong>Explanation:</strong> There are three strings in words that are a subsequence of s: "a", "acd", "ace".
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "dsahjpjauf", words = ["ahjpjau","ja","ahbwzgqnuk","tnmlanowax"]
|
||||
<strong>Output:</strong> 2
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 5 * 10<sup>4</sup></code></li>
|
||||
<li><code>1 <= words.length <= 5000</code></li>
|
||||
<li><code>1 <= words[i].length <= 50</code></li>
|
||||
<li><code>s</code> and <code>words[i]</code> consist of only lowercase English letters.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user