Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Git
- Real or Not? NLP with Disaster Tweets
- Kaggle
- Docker
- gs25
- github
- leetcode
- 편스토랑 우승상품
- ubuntu
- 편스토랑
- hackerrank
- 파이썬
- 금융문자분석경진대회
- dacon
- 프로그래머스
- ChatGPT
- programmers
- 백준
- 우분투
- Baekjoon
- SW Expert Academy
- 더현대서울 맛집
- 코로나19
- 자연어처리
- 데이콘
- PYTHON
- 캐치카페
- 프로그래머스 파이썬
- AI 경진대회
- 맥북
Archives
- Today
- Total
솜씨좋은장씨
[leetCode] 1662. Check If Two String Arrays are Equivalent (Python) 본문
Programming/코딩 1일 1문제
[leetCode] 1662. Check If Two String Arrays are Equivalent (Python)
솜씨좋은장씨 2020. 12. 12. 13:04728x90
반응형
Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise.
A string is represented by an array if the array elements concatenated in order forms the string.
Example 1:
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.
Example 2:
Input: word1 = ["a", "cb"], word2 = ["ab", "c"]
Output: false
Example 3:
Input: word1 = ["abc", "d", "defg"], word2 = ["abcddefg"]
Output: true
Constraints:
- 1 <= word1.length, word2.length <= 103
- 1 <= word1[i].length, word2[i].length <= 103
- 1 <= sum(word1[i].length), sum(word2[i].length) <= 103
- word1[i] and word2[i] consist of lowercase letters.
Solution
class Solution:
def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:
answer = False
if "".join(word1) == "".join(word2):
answer = True
return answer
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[Programmers] 두 개 뽑아서 더하기 (Python) (0) | 2020.12.18 |
---|---|
[leetCode] 1464. Maximum Product of Two Elements in an Array (Python) (0) | 2020.12.17 |
[leetCode] 1672. Richest Customer Wealth (Python) (0) | 2020.12.09 |
[leetCode] 1678. Goal Parser Interpretation (Python) (0) | 2020.12.08 |
[leetCode] 1588. Sum of All Odd Length Subarrays (Python) (0) | 2020.12.07 |
Comments