当前位置:网站首页>Dynamic planning to climb the stairs
Dynamic planning to climb the stairs
2022-07-29 16:58:00 【Artificial Intelligence Zeng Xiaojian】
class Solution:
@lru_cache(None)
def climbStairs(self, n: int) -> int:
if n == 0:
return 0
elif n == 1:
return 1
elif n == 2:
return 2
return self.climbStairs(n - 1) + self.climbStairs(n - 2)class Solution:
@lru_cache(None)
def climbStairs(self,n:int) -> int:
if n == 0:
return 0
elif n ==1:
return 1
elif n ==2:
return 2
return self.climbStairs(n-1) +self.climbStairs(n-2)边栏推荐
- Practice of Weibo Advertising Operation and Maintenance Technology Supporting Ten Billions of Requests
- 3. SAP ABAP OData 服务诊断工具 /IWFND/ERROR_LOG 的使用方法
- 传输层 TCP的连接管理-释放连接四次握手
- 【C语言刷题】Leetcode268丢失的数字
- Twin all things digital visual | join the real world and the digital space
- 公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
- CAS原理以及ABA问题解决Demo-代码
- This article penetrates the architecture design and cluster construction of the distributed storage system Ceph (hands-on)
- 【Swoole系列3.2】Swoole 异步进程服务系统
- leetcode:1901. 寻找峰值 II【二分找矩阵局部最大】
猜你喜欢
随机推荐
分布式前修课:MySQL实现分布式锁
MySQL数据库安装配置保姆级教程(以8.0.29为例)有手就行
异步请求池的实现
地平线获得舜宇集团战略投资并与舜宇智领签署战略合作协议
【服务器存储数据恢复】华为OceanStor某型号存储raid5硬盘故障离线,热备盘同步数据失败导致raid崩溃的数据恢复案例
1802. 有界数组中指定下标处的最大值【贪心 +二分】
Talking about the memory layout of the program
linux 安装mysql8.0 超详细教程(实战多次)
SQL 开始日期、结束日期查询
Google Play 政策更新 | 2022 年 7 月
生产者消费代码
MUD DAO火爆入世,DAO主轮募集蓄势待发
zabbix邮件发送告警信息
PL5902 SOT-23-5 高效1MHz2A同步DC-DC降压调节器 百盛电子代理商
Recommended Remote Desktop Tools
【Go语言刷题篇】Go完结篇函数、结构体、接口、错误入门学习
显微镜LED补光可调光源
参与造谣传谣,华为宣布开除五名员工
易基因:人类tRNA基因位点表现出与衰老相关的DNA高甲基化|研究文章
QT连接Mysql数据库(详细成功版)









