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

Commit 44c365a

Browse files
添加0746使用最小花费爬楼梯C#版本
1 parent 5ac7f64 commit 44c365a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎problems/0746.使用最小花费爬楼梯.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,26 @@ object Solution {
370370
}
371371
```
372372

373+
### C#
374+
375+
```c#
376+
public class Solution
377+
{
378+
public int MinCostClimbingStairs(int[] cost)
379+
{
380+
int[] dp=new int[2] { cost[0], cost[1] };
381+
for (int i = 2; i < cost.Length; i++)
382+
{
383+
int temp = Math.Min(dp[0], dp[1])+cost[i];
384+
dp[0]=dp[1];
385+
dp[1]=temp;
386+
}
387+
return Math.Min(dp[0],dp[1]);
388+
}
389+
}
390+
```
391+
392+
393+
373394
-----------------------
374395
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /