1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最长特殊序列 II [longest-uncommon-subsequence-ii].html

36 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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>给定字符串列表&nbsp;<code>strs</code> ,返回其中 <strong>最长的特殊序列</strong>&nbsp;的长度。如果最长特殊序列不存在,返回 <code>-1</code></p>
<p><strong>特殊序列</strong> 定义如下:该序列为某字符串 <strong>独有的子序列(即不能是其他字符串的子序列)</strong></p>
<p>&nbsp;<code>s</code>&nbsp;&nbsp;<strong>子序列</strong>可以通过删去字符串&nbsp;<code>s</code>&nbsp;中的某些字符实现。</p>
<ul>
<li>例如,<code>"abc"</code>&nbsp;<code>"aebdc"</code>&nbsp;的子序列,因为您可以删除<code>"a<u>e</u>b<u>d</u>c"</code>中的下划线字符来得到 <code>"abc"</code>&nbsp;<code>"aebdc"</code>的子序列还包括<code>"aebdc"</code><code>"aeb"</code>&nbsp;<font color="#c7254e" face="Menlo, Monaco, Consolas, Courier New, monospace"><span style="font-size: 12.6px; background-color: rgb(249, 242, 244);">""</span></font>&nbsp;(空字符串)。</li>
</ul>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong> strs = ["aba","cdc","eae"]
<strong>输出:</strong> 3
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong> strs = ["aaa","aaa","aa"]
<strong>输出:</strong> -1
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= strs.length &lt;= 50</code></li>
<li><code>1 &lt;= strs[i].length &lt;= 10</code></li>
<li><code>strs[i]</code>&nbsp;只包含小写英文字母</li>
</ul>