Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b31c233

Browse files
authored
Merge pull request neetcode-gh#1088 from agnihotriketan/patch-28
Create 55-Jump-Game.cs
2 parents 08d2884 + 81027a8 commit b31c233

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

csharp/55-Jump-Game.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class Solution {
2+
public bool CanJump(int[] nums) {
3+
int goal = nums.Length - 1;
4+
for (int i = nums.Length-1; i>=0; i--)
5+
{
6+
if (nums[i] + i >= goal)
7+
{
8+
goal = i;
9+
}
10+
}
11+
12+
return goal == 0 ;
13+
}
14+
}

0 commit comments

Comments
 (0)