LeetCode - Algorithms - 1662. Check If Two String Arrays are Equivalent

Problem

1662. Check If Two String Arrays are Equivalent

Java

jdk

1
2
3
4
5
6
7
8
9
10
11
class Solution {
public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
StringBuilder sb1 = new StringBuilder();
for(int i=0;i<word1.length;i++)
sb1.append(word1[i]);
StringBuilder sb2 = new StringBuilder();
for(int i=0;i<word2.length;i++)
sb2.append(word2[i]);
return sb1.toString().equals(sb2.toString());
}
}

Submission Detail

  • 109 / 109 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Check If Two String Arrays are Equivalent.
  • Memory Usage: 36.7 MB, less than 88.84% of Java online submissions for Check If Two String Arrays are Equivalent.