mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	国外版
This commit is contained in:
		
							
								
								
									
										38
									
								
								算法题(国外版)/check-if-two-string-arrays-are-equivalent.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								算法题(国外版)/check-if-two-string-arrays-are-equivalent.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
<p>Given two string arrays <code>word1</code> and <code>word2</code>, return<em> </em><code>true</code><em> if the two arrays <strong>represent</strong> the same string, and </em><code>false</code><em> otherwise.</em></p>
 | 
			
		||||
 | 
			
		||||
<p>A string is <strong>represented</strong> by an array if the array elements concatenated <strong>in order</strong> forms the string.</p>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Example 1:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> word1 = ["ab", "c"], word2 = ["a", "bc"]
 | 
			
		||||
<strong>Output:</strong> true
 | 
			
		||||
<strong>Explanation:</strong>
 | 
			
		||||
word1 represents string "ab" + "c" -> "abc"
 | 
			
		||||
word2 represents string "a" + "bc" -> "abc"
 | 
			
		||||
The strings are the same, so return true.</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 2:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> word1 = ["a", "cb"], word2 = ["ab", "c"]
 | 
			
		||||
<strong>Output:</strong> false
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p><strong>Example 3:</strong></p>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
<strong>Input:</strong> word1  = ["abc", "d", "defg"], word2 = ["abcddefg"]
 | 
			
		||||
<strong>Output:</strong> true
 | 
			
		||||
</pre>
 | 
			
		||||
 | 
			
		||||
<p> </p>
 | 
			
		||||
<p><strong>Constraints:</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> and <code>word2[i]</code> consist of lowercase letters.</li>
 | 
			
		||||
</ul>
 | 
			
		||||
		Reference in New Issue
	
	Block a user