Check If Two String Arrays Are Equivalent
Updated
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.
More Microsoft Onsite Interview questions
- Bad Request AlertsONSITE INTERVIEW · Seen Nov 2026
- Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
- Valid ParenthesesONSITE INTERVIEW · Seen Nov 2026
- Count a User's Actions in an Event LogONSITE INTERVIEW · Seen Nov 2026
- Smallest Batch Size Within a Step LimitONSITE INTERVIEW · Seen Nov 2026
- Count Subarrays with Equal Even and Odd CountsONSITE INTERVIEW · Seen Nov 2026
- Minimum Time to Rot All OrangesONSITE INTERVIEW · Seen Nov 2026
- Coin ChangeONSITE INTERVIEW · Seen Oct 2026
- Daily USD Totals with Effective-Dated Exchange RatesONSITE INTERVIEW · Seen Oct 2026
- Number Words to Digits in Any LanguageONSITE INTERVIEW · Seen Oct 2026
Similar questions at other companies
- Reverse the Interior of Vowel-Bounded WordsVisa · OAVisa interview questions
- Reverse the Interior of Vowel-Bounded WordsZipRecruiter · OAZipRecruiter interview questions
- Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
- Objects Seen on Both Days by Multiple ClientsGoogle · PHONE SCREENGoogle interview questions
- Longest Common PrefixKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Longest Spoken PrefixElevenLabs · ONSITE INTERVIEWElevenLabs interview questions
- Palindrome Check Ignoring SymbolsWalmart · ONSITE INTERVIEWWalmart interview questions
- Reverse a String Keeping Dashes in PlaceNykaa · ONSITE INTERVIEWNykaa interview questions
- Merge Sorted ArrayDP World · ONSITE INTERVIEW
- Map and Accumulate Learning QueriesPalantir · ONSITE INTERVIEWPalantir interview questions