当前位置:网站首页>LeetCode 1662. Check whether two string arrays are equal
LeetCode 1662. Check whether two string arrays are equal
2022-06-24 04:51:00 【freesan44】
subject
Here are two string arrays word1 and word2 . If two arrays represent the same string , return true ; otherwise , return false .
Array representation string Is made up of all the elements in the array According to the order The string formed by the connection .
Example 1: Input :word1 = ["ab", "c"], word2 = ["a", "bc"] Output :true explain : word1 The string represented is "ab" + "c" -> "abc" word2 The string represented is "a" + "bc" -> "abc" The two strings are the same , return true Example 2: Input :word1 = ["a", "cb"], word2 = ["ab", "c"] Output :false Example 3: Input :word1 = ["abc", "d", "defg"], word2 = ["abcddefg"] Output :true
Tips :
1 <= word1.length, word2.length <= 103
1 <= word1i.length, word2i.length <= 103
1 <= sum(word1i.length), sum(word2i.length) <= 103
word1i and word2i It's made up of lowercase letters
Their thinking
class Solution:
def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:
# use join, hold list Turn into str
word1Str = "".join(word1)
word2Str = "".join(word2)
return word1Str == word2Str
if __name__ == '__main__':
word1 = ["ab", "c"]
word2 = ["a", "bc"]
word1 = ["a", "cb"]
word2 = ["ab", "c"]
ret = Solution().arrayStringsAreEqual(word1, word2)
print(ret)边栏推荐
- 『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole
- Introduction to C language custom types (structure, enumeration, union, bit segment)
- I have an agreement with IOT
- Doctor application | Hong Kong University of science and Technology (Guangzhou) Mr. Liu Hao recruits the full award doctor / Master in data mining
- An interface testing software that supports offline document sharing in the Intranet
- mysql中表的命名
- Summary of Android interview questions in 2020 (elementary)
- SAP mts/ato/mto/eto topic 8: ATO mode 2 d+ empty mode strategy 85
- External network access SVN server (external network access SVN server deployed on the cloud)
- Bi-sql where
猜你喜欢

Idea creates a servlet and accesses the 404 message

Popularization of children's programming education in specific scenarios

Idea创建Servlet 后访问报404问题

解析后人类时代类人机器人的优越性

2022年二级造价工程师备考攻略,你准备好了吗?

Zhang Xiaodan, chief architect of Alibaba cloud hybrid cloud: evolution and development of government enterprise hybrid cloud technology architecture

阿里云新一代云计算体系架构 CIPU 到底是啥?

External network access SVN server (external network access SVN server deployed on the cloud)

Introduction à la méthode de descente par Gradient - document d'apprentissage automatique pour les programmeurs de chevaux noirs

Apipost interface assertion details
随机推荐
The trunk warehouse can also be tob, and Tencent cloud microenterprises do not leave quality behind
Easyanticheat uses to inject unsigned code into a protected process (2)
Recognize workplus again, not only im but also enterprise mobile application management expert
How does the compiler put the first instruction executed by the chip at the start address of the chip?
Chemical properties and specificity of Worthington Papain
Disaster recovery series (IV) - disaster recovery construction of business application layer
Training methods after the reform of children's programming course
图书馆管理后台
What is the role of ECS? How does FTP connect to ECS configuration?
How to add a domain name to ECS? What are the advantages of ECS?
mysql中表的命名
How do ECS create FTP accounts? What should I pay attention to during creation?
SAP MTS/ATO/MTO/ETO专题之七:ATO模式1 M+M模式策略用82(6892)
How to select a suitable optical fiber tester
Spirit breath development log (16)
Lldb common commands
What are the functions of ASP files on ECs? What if the ECS cannot run ASP with a low version?
What is the principle of Ping? How does the server disable Ping?
Summary of Android interview questions in 2020 (elementary)
Real time monitoring: system and application level real-time monitoring based on flow computing Oceanus (Flink)