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)/串联字符串的最大长度 [maximum-length-of-a-concatenated-string-with-unique-characters].html

48 lines
1.3 KiB
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p>给定一个字符串数组 <code>arr</code>,字符串 <code>s</code> 是将 <code>arr</code>&nbsp;的含有 <strong>不同字母</strong>&nbsp;<strong>子序列</strong> 字符串 <strong>连接</strong> 所得的字符串。</p>
<p>请返回所有可行解 <code>s</code> 中最长长度。</p>
<p><strong>子序列</strong> 是一种可以从另一个数组派生而来的数组,通过删除某些元素或不删除元素而不改变其余元素的顺序。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>arr = ["un","iq","ue"]
<strong>输出:</strong>4
<strong>解释:</strong>所有可能的串联组合是:
- ""
- "un"
- "iq"
- "ue"
- "uniq" ("un" + "iq")
- "ique" ("iq" + "ue")
最大长度为 4。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>arr = ["cha","r","act","ers"]
<strong>输出:</strong>6
<strong>解释:</strong>可能的解答有 "chaers" 和 "acters"。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>arr = ["abcdefghijklmnopqrstuvwxyz"]
<strong>输出:</strong>26
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= arr.length &lt;= 16</code></li>
<li><code>1 &lt;= arr[i].length &lt;= 26</code></li>
<li><code>arr[i]</code>&nbsp;中只含有小写英文字母</li>
</ul>