[LeetCode]#1662. Check If Two String Arrays are Equivalent

Input: word1 = ["ab", "c"], word2 = ["a", "bc"]
Output: true
Explanation:
word1 represents string "ab" + "c" -> "abc"
word2 represents string "a" + "bc" -> "abc"
The strings are the same, so return true.
  1. Combine with strings in a list as one string
  2. Compare two strings
class Solution:
def arrayStringsAreEqual(self, word1, word2 ):

return "".join(word1)=="".join(word2)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store