1781. Check If Two String Arrays are Equivalent
My accepted Python solution to LeetCode problem 1781, Check If Two String Arrays are Equivalent, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2025-12-29.
class Solution:
def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:
# Concatenate both and compare
# Time: O(n + m), Space: O(n + m) where n, m are total chars
return ''.join(word1) == ''.join(word2)