mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
36 lines
1.3 KiB
HTML
36 lines
1.3 KiB
HTML
<p>给你一个字符串数组 <code>words</code> ,找出并返回 <code>length(words[i]) * length(words[j])</code> 的最大值,并且这两个单词不含有公共字母。如果不存在这样的两个单词,返回 <code>0</code> 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>words = <code>["abcw","baz","foo","bar","xtfn","abcdef"]</code>
|
||
<strong>输出:</strong><code>16
|
||
<strong>解释</strong></code><strong>:</strong><code>这两个单词为<strong> </strong>"abcw", "xtfn"</code>。</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>words = <code>["a","ab","abc","d","cd","bcd","abcd"]</code>
|
||
<strong>输出:</strong><code>4
|
||
<strong>解释</strong></code><strong>:</strong>这两个单词为 <code>"ab", "cd"</code>。</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>words = <code>["a","aa","aaa","aaaa"]</code>
|
||
<strong>输出:</strong><code>0
|
||
<strong>解释</strong></code><strong>:</strong><code>不存在这样的两个单词。</code>
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>2 <= words.length <= 1000</code></li>
|
||
<li><code>1 <= words[i].length <= 1000</code></li>
|
||
<li><code>words[i]</code> 仅包含小写字母</li>
|
||
</ul>
|