mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
first commit
This commit is contained in:
26
算法题/longest-word-in-dictionary-through-deleting.html
Normal file
26
算法题/longest-word-in-dictionary-through-deleting.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<p>Given a string <code>s</code> and a string array <code>dictionary</code>, return <em>the longest string in the dictionary that can be formed by deleting some of the given string characters</em>. If there is more than one possible result, return the longest word with the smallest lexicographical order. If there is no possible result, return the empty string.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abpcplea", dictionary = ["ale","apple","monkey","plea"]
|
||||
<strong>Output:</strong> "apple"
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abpcplea", dictionary = ["a","b","c"]
|
||||
<strong>Output:</strong> "a"
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 1000</code></li>
|
||||
<li><code>1 <= dictionary.length <= 1000</code></li>
|
||||
<li><code>1 <= dictionary[i].length <= 1000</code></li>
|
||||
<li><code>s</code> and <code>dictionary[i]</code> consist of lowercase English letters.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user