Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfb0dfb7

Browse files
author
wb-hjk570755
committed
跳阶梯
1 parentc7fb61e commitfb0dfb7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎src/com/blankj/myself/SkipLadder.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
packagecom.blankj.myself;
2+
3+
/**
4+
* Description:
5+
* Copyright: Copyright (c) 2012
6+
* Company: keruyun Technology(Beijing) Chengdu Co. Ltd.
7+
*
8+
* @author huangjk
9+
* @version 1.0 2020/5/20
10+
*/
11+
publicclassSkipLadder {
12+
publicstaticvoidmain(String[]args) {
13+
14+
}
15+
16+
publicintclimbStairs(intn) {
17+
if(n==1){
18+
return1;
19+
}
20+
int[]nums =newint[n];
21+
nums[0] =1;
22+
nums[1] =2;
23+
for (inti=2;i<n;i++){
24+
nums[i] =nums[i-2] +nums[i-1];
25+
}
26+
returnnums[n-1];
27+
}
28+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp