力扣 1662. 检查两个字符串数组是否相等

解法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def arrayStringsAreEqual(word1, word2):
j, c_j, cur2, w2_num = 0, 0, word2[0], len(word2)
for i in range(len(word1)):
for c in word1[i]:
if c_j >= len(cur2):
j += 1
if j >= w2_num:
return False
cur2 = word2[j]
c_j = 0
# print(c, cur2[c_j])
if c != cur2[c_j]:
return False
c_j += 1
if j + 1 < w2_num or c_j < len(cur2):
return False
return True
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2022 eightyninth
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信