当前位置:网站首页>JZ71 跳台阶扩展问题
JZ71 跳台阶扩展问题
2022-07-25 18:13:00 【syc596】
JZ71 跳台阶扩展问题
跳台阶扩展问题_牛客题霸_牛客网 (nowcoder.com)
// //递归
// public class Solution {
// public int jumpFloorII(int target) {
// if(target<=1){
// return 1;
// }
// return 2*jumpFloorII(target-1);
// }
// }
//11
//动规dp
public class Solution {
public int jumpFloorII(int target) {
int[] dp=new int[target+1];
dp[0]=1;
dp[1]=1;
for(int i=2;i<=target;i++){
dp[i]=2*dp[i-1];
}
return dp[target];
}
}边栏推荐
猜你喜欢

Drawing PDF form (II) drawing excel form style in PDF through iText, setting Chinese font, watermark, logo, header and page number

Idea integrates common functions of SVN code management

Tkinter GUI address book management system

Good news! Ruiyun technology was awarded the member unit of 5g integrated application special committee of "sailing on the sea"

imx6 RTL8189FTV移植

TME2022校园招聘后台开发/运营开发/业务运维/应用开发笔试(I)编程题的一点自我分析

Construction of Huffman tree

SLA 、SLO & SLI

Express of nodejs simple example program

Auditing related notes
随机推荐
对角化、A的幂
STM8S003F3 内部flash调试
Conversion between integer and string in C language
Redis source code and design analysis -- 17. Redis event processing
Connect to MySQL using sqldeveloper
Memory and packet buffer management of LwIP
imx6 RTL8189FTV移植
SQL那些事
LeetCode 101. 对称二叉树 && 100. 相同的树 && 572. 另一棵树的子树
Use of join function in MATLAB
国际权威认可!OceanBase入选Forrester Translytical数据平台报告
UnitTest框架应用
Itextpdf realizes the merging of multiple PDF files into one PDF document
srec_cat 常用参数的使用
c语言---25 扫雷游戏
The use of invocationcount, threadpoolsize, timeout of concurrent tests in TestNG
MySQL 索引优化全攻略
PHP memory management mechanism and garbage collection mechanism
使用sqldeveloper连接mysql
Unittest framework application