mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你两个字符串数组 <code>word1</code> 和 <code>word2</code> 。如果两个数组表示的字符串相同,返回<em> </em><code>true</code><em> </em>;否则,返回 <code>false</code><em> 。</em></p>
 | 
						||
 | 
						||
<p><strong>数组表示的字符串</strong> 是由数组中的所有元素 <strong>按顺序</strong> 连接形成的字符串。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>word1 = ["ab", "c"], word2 = ["a", "bc"]
 | 
						||
<strong>输出:</strong>true
 | 
						||
<strong>解释:</strong>
 | 
						||
word1 表示的字符串为 "ab" + "c" -> "abc"
 | 
						||
word2 表示的字符串为 "a" + "bc" -> "abc"
 | 
						||
两个字符串相同,返回 true</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>word1 = ["a", "cb"], word2 = ["ab", "c"]
 | 
						||
<strong>输出:</strong>false
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 3:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>word1  = ["abc", "d", "defg"], word2 = ["abcddefg"]
 | 
						||
<strong>输出:</strong>true
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= word1.length, word2.length <= 10<sup>3</sup></code></li>
 | 
						||
	<li><code>1 <= word1[i].length, word2[i].length <= 10<sup>3</sup></code></li>
 | 
						||
	<li><code>1 <= sum(word1[i].length), sum(word2[i].length) <= 10<sup>3</sup></code></li>
 | 
						||
	<li><code>word1[i]</code> 和 <code>word2[i]</code> 由小写字母组成</li>
 | 
						||
</ul>
 |