일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 만화도
- 사이드
- 리얼 클래스
- 잡생각
- 괜찮음
- 쓰릴오브파이트
- 개발자
- 링피트
- 영어공부
- 운동
- 읽기
- Problem Solving
- 매일
- 뭐든
- 10분
- 월간
- 프로젝트
- realclass
- leetcode
- 30분
- English
- Writing
- 화상영어
- 스탭퍼
- 영어원서읽기
- 3줄정리
- 미드시청
- Daily Challenge
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/partitioning-into-minimum-number-of-deci-binary-numbers/
Partitioning Into Minimum Number Of Deci-Binary Numbers - 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
엄청 간단하게 풂. (물론 효율은 하위 5%)
그냥 문제와 예를 잘 읽어보면, 전체 숫자 중에 가장 큰 값을 출력해주면 됨.
class Solution:
def minPartitions(self, n: str) -> int:
res = 0
for nn in n:
res = max(res, int(nn))
return res
그냥 list(map) 써서 개선했더니 하위 30%로 올라감
class Solution:
def minPartitions(self, n: str) -> int:
return max(list(map(int,n)))
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.06.29 |
---|---|
Today's Challenge (0) | 2022.06.28 |
Today's Challenge (0) | 2022.06.26 |
Today's Challenge (0) | 2022.06.25 |
Today's Challenge (0) | 2022.06.24 |
Comments