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-product-of-word-lengths].html
2022-03-29 12:43:11 +08:00

36 lines
1.3 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>words</code> ,找出并返回 <code>length(words[i]) * length(words[j])</code>&nbsp;的最大值,并且这两个单词不含有公共字母。如果不存在这样的两个单词,返回 <code>0</code></p>
<p>&nbsp;</p>
<p><strong>示例&nbsp;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>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= words.length &lt;= 1000</code></li>
<li><code>1 &lt;= words[i].length &lt;= 1000</code></li>
<li><code>words[i]</code>&nbsp;仅包含小写字母</li>
</ul>