mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-29 03:30:26 +08:00
17 lines
740 B
HTML
17 lines
740 B
HTML
<p>Given a list of words, write a program to find the longest word made of other words in the list. If there are more than one answer, return the one that has smallest lexicographic order. If no answer, return an empty string.</p>
|
|
|
|
<p><strong>Example: </strong></p>
|
|
|
|
<pre>
|
|
<strong>Input: </strong> ["cat","banana","dog","nana","walk","walker","dogwalker"]
|
|
<strong>Output: </strong> "dogwalker"
|
|
<strong>Explanation: </strong> "dogwalker" can be made of "dog" and "walker".
|
|
</pre>
|
|
|
|
<p><strong>Note: </strong></p>
|
|
|
|
<ul>
|
|
<li><code>0 <= len(words) <= 200</code></li>
|
|
<li><code>1 <= len(words[i]) <= 100</code></li>
|
|
</ul>
|