题目链接
https://leetcode.cn/problems/check-if-two-string-arrays-are-equivalent/
题目
我的思路
用两个StringBuilder,分别记录数组中所有的元素合并起来,最后判断两个StringBuiler的内容是否相等
class Solution {
public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
StringBuilder sb1 = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
for (String s : word1) {
sb1.append(s);
}
for (String s : word2) {
sb2.append(s);
}
return sb1.toString().equals(sb2.toString());
}
}