| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 파비최
- 영어원서읽기
- 미드시청
- 스탭퍼
- 만화도
- 월간
- 뭐든
- 쓰릴오브파이트
- 영어공부
- 화상영어
- 10분
- Daily Challenge
- 3줄정리
- FIT XR
- Problem Solving
- English
- 리얼 클래스
- 매일
- 30분
- 괜찮음
- realclass
- Writing
- 링피트
- 사이드
- 프로젝트
- 잡생각
- leetcode
- 개발자
- 읽기
- 운동
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/unique-morse-code-words/
Unique Morse Code 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
오늘도 Easy 난이도긴 한데.. 뭔가 어려워.......보였는데 생각보다 쉬웠음
class Solution:
def uniqueMorseRepresentations(self, words: List[str]) -> int:
codes = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]
res = set()
for word in words:
trans_word = ''
for w in word:
trans_word += codes[ord(w)-ord('a')]
res.add(trans_word)
return len(res)반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2022.08.19 |
|---|---|
| Today's Challenge (0) | 2022.08.18 |
| Today's Challenge (0) | 2022.08.16 |
| Today's Challenge (0) | 2022.08.15 |
| Today's Challenge (0) | 2022.08.14 |
Comments