From e209d3514302398515061906102cf3a42a4588ad Mon Sep 17 00:00:00 2001 From: eeee0717 Date: Fri, 29 Dec 2023 16:45:31 +0800 Subject: [PATCH] =?UTF-8?q?Update0055.=E8=B7=B3=E8=B7=83=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0C#?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0055.跳跃游戏.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/problems/0055.跳跃游戏.md b/problems/0055.跳跃游戏.md index bedb09ab..086fd64f 100644 --- a/problems/0055.跳跃游戏.md +++ b/problems/0055.跳跃游戏.md @@ -258,6 +258,23 @@ object Solution { } } ``` +### C# +```csharp +public class Solution +{ + public bool CanJump(int[] nums) + { + int cover = 0; + if (nums.Length == 1) return true; + for (int i = 0; i <= cover; i++) + { + cover = Math.Max(i + nums[i], cover); + if (cover >= nums.Length - 1) return true; + } + return false; + } +} +```