1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最短超级串 [find-the-shortest-superstring].html
2022-03-29 12:43:11 +08:00

30 lines
1.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个字符串数组 <code>words</code>,找到以 <code>words</code> 中每个字符串作为子字符串的最短字符串。如果有多个有效最短字符串满足题目条件,返回其中 <strong>任意一个</strong> 即可。</p>
<p>我们可以假设 <code>words</code> 中没有字符串是 <code>words</code> 中另一个字符串的子字符串。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>words = ["alex","loves","leetcode"]
<strong>输出:</strong>"alexlovesleetcode"
<strong>解释:</strong>"alex""loves""leetcode" 的所有排列都会被接受。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>words = ["catg","ctaagt","gcta","ttca","atgcatc"]
<strong>输出:</strong>"gctaagttcatgcatc"</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 <= words.length <= 12</code></li>
<li><code>1 <= words[i].length <= 20</code></li>
<li><code>words[i]</code> 由小写英文字母组成</li>
<li><code>words</code> 中的所有字符串 <strong>互不相同</strong></li>
</ul>