Answer: YULU Off-Campus OA (2025) | Check if Two String Arrays are Equivalent

Answer · Posted Jun 2026

Approach 1: Concatenate and Compare Join all strings in both arrays and compare the resulting strings. Strategy Convert each array into a single string. Compare the two strings. Return the result. class Solution { public boolean arrayStringsAreEqual(String[] word1, String[] word2) { int w1 = 0, c1 = 0; int w2 = 0, c2 = 0; while (w1 < word1.length && w2 < word2.length) { if (word1[w1].charAt(c1) != word2[w2].charAt(c2)) return false; c1++; c2++; if (c1 == word1[w1].length()) { w1++; c1 = ...

The full answer & interview discussion are available to premium members.

Log in Create a free account