Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 파이썬 알고리즘
- leetcode풀이
- 릿코드
- 릿코드풀기
- leetcode 풀기
- python 알고리즘
- 파이썬릿코드
- 잇츠디모
- python zip_longest
- leetcode풀기
- 파이썬알고리즘
- 릿코드 파이썬
- python 릿코드
- 알고리즘풀기
- 알고리즘풀이
- 릿코드 풀기
- 릿코드풀이
- 파이썬 릿코드
- python priority queue
- 코틀린기초
- 파이썬알고리즘풀기
- binary search
- python Leetcode
- 파이썬 프로그래머스
- 상가수익률계산기
- LeetCode
- python sorted
- 파이썬릿코드풀기
- 파이썬 알고리즘 풀기
- python xor
Archives
- Today
- Total
소프트웨어에 대한 모든 것
LeetCode 풀기 - 1880. Check if Word Equals Summation of Two Words 본문
반응형
1880. Check if Word Equals Summation of Two Words
https://leetcode.com/problems/check-if-word-equals-summation-of-two-words/
Check if Word Equals Summation of Two Words - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
문제)
솔루션1)
class Solution:
def isSumEqual(self, firstWord: str, secondWord: str, targetWord: str) -> bool:
d = {c: str(i) for i, c in enumerate("abcdefghij") }
def word_to_int(word):
res = [d[c] for c in word]
return int(''.join(res))
a = word_to_int(firstWord)
b = word_to_int(secondWord)
c = word_to_int(targetWord)
return (a+b) == c
반응형
Comments