Check if two string arrays are equivalent

October 25, 2022

array-and-hashmap

Problem URL: Check if two string arrays are equivalent

We will join the two arrays to strings and check if they are equal.

class Solution:
    def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:
        return ''.join(word1) == ''.join(word2)

Time Complexity: O(n)
Space Complexity: O(n)