package leetcode;

/**
 * https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/
 */
public class Problem1662 {
    public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1662 prob = new Problem1662();
        System.out.println(prob.arrayStringsAreEqual(
            new String[]{"ab", "c"}, new String[]{"a", "bc"})); // true
        System.out.println(prob.arrayStringsAreEqual(
            new String[]{"a", "cb"}, new String[]{"ab", "c"})); // false
        System.out.println(prob.arrayStringsAreEqual(
            new String[]{"abc", "d", "defg"}, new String[]{"abcddefg"})); // true
    }
}

package leetcode;

import java.util.Arrays;
import java.util.stream.Collectors;

/**
 * https://leetcode.com/problems/check-if-two-string-arrays-are-equivalent/
 */
public class Problem1662 {
    public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
        String s1 = Arrays.stream(word1).collect(Collectors.joining(""));
        String s2 = Arrays.stream(word2).collect(Collectors.joining(""));
        return s1.equals(s2);
    }
}

Solve problem 1662