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

[pull] master from youngyangyang04:master #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 5 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions problems/0062.不同路径.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -452,5 +452,25 @@ object Solution {
}
```

### c#

```c#
public class Solution
{
public int UniquePaths(int m, int n)
{
int[] dp = new int[n];
for (int i = 0; i < n; i++)
dp[i] = 1;
for (int i = 1; i < m; i++)
for (int j = 1; j < n; j++)
dp[j] += dp[j - 1];
return dp[n - 1];
}
}
```



-----------------------
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>
20 changes: 20 additions & 0 deletions problems/0070.爬楼梯.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -425,5 +425,25 @@ object Solution {
}
```

### C#

```c#
public class Solution {
public int ClimbStairs(int n) {
if(n<=2) return n;
int[] dp = new int[2] { 1, 2 };
for (int i = 3; i <= n; i++)
{
int temp = dp[0] + dp[1];
dp[0] = dp[1];
dp[1] = temp;
}
return dp[1];
}
}
```



-----------------------
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>
40 changes: 40 additions & 0 deletions problems/0509.斐波那契数.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,45 @@ object Solution {
}
```

### C#

动态规划:

```c#
public class Solution
{
public int Fib(int n)
{
if(n<2) return n;
int[] dp = new int[2] { 0, 1 };
for (int i = 2; i <= n; i++)
{
int temp = dp[0] + dp[1];
dp[0] = dp[1];
dp[1] = temp;
}
return dp[1];
}
}
```

递归:

```c#
public class Solution
{
public int Fib(int n)
{
if(n<2)
return n;
return Fib(n-1)+Fib(n-2);
}
}
```





-----------------------
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>
21 changes: 21 additions & 0 deletions problems/0746.使用最小花费爬楼梯.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,26 @@ object Solution {
}
```

### C#

```c#
public class Solution
{
public int MinCostClimbingStairs(int[] cost)
{
int[] dp=new int[2] { cost[0], cost[1] };
for (int i = 2; i < cost.Length; i++)
{
int temp = Math.Min(dp[0], dp[1])+cost[i];
dp[0]=dp[1];
dp[1]=temp;
}
return Math.Min(dp[0],dp[1]);
}
}
```



-----------------------
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>

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