首页 > 其他分享 >1662. 检查两个字符串数组是否相等

1662. 检查两个字符串数组是否相等

时间:2022-11-01 09:46:01浏览次数:69  
标签:String StringBuilder w2 数组 字符串 1662 w1

检查两个字符串数组是否相等

class Solution {
   public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
        StringBuilder w1 = new StringBuilder();
        for (String s : word1) {
            w1.append(s);
        }
        StringBuilder w2 = new StringBuilder();
        for (String s : word2) {
            w2.append(s);
        }
        return w1.toString().equals(w2.toString());
    }
}

标签:String,StringBuilder,w2,数组,字符串,1662,w1
From: https://www.cnblogs.com/eiffelzero/p/16846655.html

相关文章