mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给定一个字符串数组 <code>words</code>,请计算当两个字符串 <code>words[i]</code> 和 <code>words[j]</code> 不包含相同字符时,它们长度的乘积的最大值。假设字符串中只包含英语的小写字母。如果没有不包含相同字符的一对字符串,返回 0。</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
 | 
						|
<p><strong>示例 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>输入:</strong> words = <code>["abcw","baz","foo","bar","fxyz","abcdef"]</code>
 | 
						|
<strong>输出: </strong><code>16 
 | 
						|
<strong>解释:</strong> 这两个单词为<strong> </strong></code><code>"abcw", "fxyz"</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>这两个单词为 <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>
 | 
						|
</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>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
 | 
						|
<p><meta charset="UTF-8" />注意:本题与主站 318 题相同:<a href="https://leetcode-cn.com/problems/maximum-product-of-word-lengths/">https://leetcode-cn.com/problems/maximum-product-of-word-lengths/</a></p>
 |