| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 사이드
- 10분
- Writing
- 30분
- 영어공부
- 프로젝트
- English
- 개발자
- 화상영어
- 리얼 클래스
- 월간
- 읽기
- 매일
- Problem Solving
- 운동
- Daily Challenge
- 파비최
- 잡생각
- 미드시청
- 만화도
- realclass
- 쓰릴오브파이트
- FIT XR
- 링피트
- 뭐든
- leetcode
- 영어원서읽기
- 3줄정리
- 괜찮음
- 스탭퍼
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/
Number of Steps to Reduce a Number to Zero - 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 numberOfSteps(self, num: int) -> int:
res = 0
while num > 0:
if num % 2 == 0:
num //= 2
else:
num -= 1
res += 1
return res반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| Today's Challenge (0) | 2022.05.29 |
|---|---|
| Today's Challenge (0) | 2022.05.28 |
| Today's Challenge (0) | 2022.05.26 |
| Today's Challenge (0) | 2022.05.25 |
| Today's Challenge (0) | 2022.05.24 |
Comments