1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/检查两个字符串数组是否相等 [check-if-two-string-arrays-are-equivalent].html
2022-03-29 12:43:11 +08:00

41 lines
1.3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>给你两个字符串数组 <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>