diff --git a/problems/0045.跳跃游戏II.md b/problems/0045.跳跃游戏II.md index aab27b27..e006caa2 100644 --- a/problems/0045.跳跃游戏II.md +++ b/problems/0045.跳跃游戏II.md @@ -464,6 +464,27 @@ impl Solution { } } ``` +### C# +```csharp +// 版本二 +public class Solution +{ + public int Jump(int[] nums) + { + int cur = 0, next = 0, step = 0; + for (int i = 0; i < nums.Length - 1; i++) + { + next = Math.Max(next, i + nums[i]); + if (i == cur) + { + cur = next; + step++; + } + } + return step; + } +} +```