Check If Two String Arrays Are Equivalent
Problem statement
You are given two arrays of non-empty string fragments, word1 and word2.
Concatenate the fragments in each array in order. Return true when the two resulting strings are exactly equal, and return false otherwise.
Comparison is case-sensitive.
Function
arrayStringsAreEqual(word1: String[], word2: String[]) → booleanExamples
Example 1
word1 = ["Mic","ro","soft"]word2 = ["M","ic","roso","ft"]return = trueBoth arrays concatenate to Microsoft.
Example 2
word1 = ["ab","c"]word2 = ["a","bc"]return = trueThe fragment boundaries differ, but both arrays form abc.
Example 3
word1 = ["a","cb"]word2 = ["ab","c"]return = falseThe arrays form acb and abc, which differ.
Constraints
1 <= word1.length, word2.length <= 1000- Every fragment contains from
1through1000letters. - The total number of characters in each array is at most
100000. - Comparison is case-sensitive.