1
2
3
4
5
6
7
8
9
10
11
|
class Solution:
def isSumEqual(self, firstWord: str, secondWord: str, targetWord: str) -> bool:
wordToint1=''
wordToint2=''
wordToint3=''
for i in firstWord: wordToint1+=str(ord(i)-97)
for i in secondWord: wordToint2+=str(ord(i)-97)
for i in targetWord: wordToint3+=str(ord(i)-97)
if int(wordToint1)+int(wordToint2)==int(wordToint3) : return True
else: return False
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1460. Make Two Arrays Equal by Reversing Sub-arrays (0) | 2022.03.21 |
---|---|
leetcode 2032. Two Out of Three (0) | 2022.03.21 |
leetcode 2053. Kth Distinct String in an Array (0) | 2022.03.21 |
leetcode 2057. Smallest Index With Equal Value (0) | 2022.03.21 |
leetcode 2154. Keep Multiplying Found Values by Two (0) | 2022.03.21 |
댓글