일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 운동
- 30분
- 월간
- 뭐든
- 개발자
- 쓰릴오브파이트
- FIT XR
- 만화도
- 10분
- Writing
- 매일
- 사이드
- English
- 미드시청
- Daily Challenge
- 영어공부
- leetcode
- 읽기
- 리얼 클래스
- 화상영어
- 링피트
- 3줄정리
- 괜찮음
- realclass
- 파비최
- 프로젝트
- Problem Solving
- 잡생각
- 스탭퍼
- 영어원서읽기
Archives
- Today
- Total
파비의 매일매일 공부기록
Today's Challenge 본문
https://leetcode.com/problems/climbing-stairs/
Climbing Stairs - 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
완전 탐색이 가능한 문제 (N이 작음)
lru_cache라는걸 쓰면 효율이 좀 더 늘어나는 듯
class Solution:
@lru_cache(None)
def climbStairs(self, n: int) -> int:
return 1 if n < 2 else self.climbStairs(n-1) + self.climbStairs(n-2)
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
Today's Challenge (0) | 2022.12.14 |
---|---|
Today's Challenge (0) | 2022.12.13 |
Today's Challenge (0) | 2022.12.09 |
Today's Challenge (0) | 2022.12.08 |
Today's Challenge (0) | 2022.12.07 |
Comments