일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 개발자
- 10분
- 30분
- 프로젝트
- FIT XR
- 영어원서읽기
- 3줄정리
- 읽기
- 링피트
- 사이드
- leetcode
- 리얼 클래스
- 파비최
- 매일
- Problem Solving
- 만화도
- English
- 월간
- 괜찮음
- 영어공부
- 쓰릴오브파이트
- Daily Challenge
- 화상영어
- Writing
- 뭐든
- 미드시청
- 스탭퍼
- 운동
- realclass
- 잡생각
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.09.25 Today's Challenge 본문
https://leetcode.com/problems/find-the-difference/
LeetCode - The World's Leading Online Programming Learning Platform
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
해쉬 테이블로 푸는 문제.
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
ar = [0] * 26
for tt in t:
ar[ord(tt) - ord('a')] += 1
for ss in s:
ar[ord(ss) - ord('a')] -= 1
for i in range(26):
if ar[i] > 0:
return chr(i + ord('a'))
return ""
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.09.27 Today's Challenge (0) | 2023.09.27 |
---|---|
2023.09.26 Today's Challenge (0) | 2023.09.26 |
2023.09.24 Today's Challenge (0) | 2023.09.24 |
2023.09.23 Today's Challenge (0) | 2023.09.23 |
2023.09.22 Today's Challenge (0) | 2023.09.22 |
Comments