일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 쓰릴오브파이트
- English
- 운동
- 뭐든
- 프로젝트
- FIT XR
- 월간
- 스탭퍼
- leetcode
- 읽기
- 미드시청
- 사이드
- 괜찮음
- 링피트
- 리얼 클래스
- 영어원서읽기
- 파비최
- 영어공부
- Writing
- realclass
- Daily Challenge
- 만화도
- 매일
- 30분
- 개발자
- Problem Solving
- 화상영어
- 잡생각
- 10분
- 3줄정리
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/power-of-three/submissions/
Power of Three - 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 isPowerOfThree(self, n: int) -> bool:
if n == 1:
return True
if n < 3:
return False
while n > 1:
if n % 3 != 0:
return False
n //= 3
return True
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.08.26 |
---|---|
Today's Challenge (0) | 2022.08.25 |
Today's Challenge (0) | 2022.08.23 |
Today's Challenge (0) | 2022.08.22 |
Today's Challenge (0) | 2022.08.21 |
Comments