FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
algorithm/Week_04/id_115/leetcode_746_115.java at master · isnotnull/algorithm · GitHub
isnotnull
/
algorithm
Public
forked from
algorithm001/algorithm
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
algorithm
/
Week_04
/
id_115
/
leetcode_746_115.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
11 lines (11 loc) · 345 Bytes
Breadcrumbs
algorithm
/
Week_04
/
id_115
/
leetcode_746_115.java
Copy path
File metadata and controls
11 lines (11 loc) · 345 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
class
Solution
{
public
int
minCostClimbingStairs
(
int
[]
cost
) {
int
[]
f
=
new
int
[
cost
.
length
+
1
];
//到达每层楼最小花费
f
[
0
] =
0
;
f
[
1
] =
0
;
for
(
int
i
=
2
;
i
<=
cost
.
length
;
i
++) {
f
[
i
] =
Math
.
min
(
f
[
i
-
1
] +
cost
[
i
-
1
],
f
[
i
-
2
] +
cost
[
i
-
2
]);
}
return
f
[
cost
.
length
];
}
}
Back
|
FazBrowse Home
|
New Git URL