일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 만화도
- 뭐든
- 화상영어
- 잡생각
- 운동
- FIT XR
- 사이드
- 10분
- 30분
- 쓰릴오브파이트
- 월간
- 리얼 클래스
- Writing
- 링피트
- 괜찮음
- realclass
- 개발자
- 파비최
- 프로젝트
- 영어공부
- 매일
- leetcode
- 3줄정리
- 미드시청
- 스탭퍼
- 읽기
- 영어원서읽기
- Daily Challenge
- Problem Solving
- English
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/make-the-string-great/
Make The String Great - 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
여러가지 방법이 있는데, 투 포인터 쓰는게 제일 나을듯
나는 재귀 솔루션 참고함. (제일 짧아서 ㅋㅋㅋㅋㅋ)
class Solution:
def makeGood(self, s: str) -> str:
for i in range(len(s) - 1):
if abs(ord(s[i]) - ord(s[i+1])) == 32:
return self.makeGood(s[:i] + s[i + 2:])
return s
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.11.10 |
---|---|
Today's Challenge (0) | 2022.11.09 |
Today's Challenge (0) | 2022.11.07 |
Today's Challenge (0) | 2022.11.06 |
Today's Challenge (0) | 2022.11.05 |
Comments