mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.7 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 = ["abcw","baz","foo","bar","fxyz","abcdef"]
 | 
						||
<strong>输出:</strong>16 
 | 
						||
<strong>解释:</strong>这两个单词为<strong> </strong>"abcw", "fxyz"。它们不包含相同字符,且长度的乘积最大。</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>words = ["a","ab","abc","d","cd","bcd","abcd"]
 | 
						||
<strong>输出:</strong>4 
 | 
						||
<strong>解释:</strong>这两个单词为 "ab", "cd"。</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>words = ["a","aa","aaa","aaaa"]
 | 
						||
<strong>输出:</strong>0 
 | 
						||
<strong>解释:</strong>不存在这样的两个单词。
 | 
						||
</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>
 |