We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 499baf9 commit fb9fd2fCopy full SHA for fb9fd2f
55. Jump Game.cpp
@@ -0,0 +1,11 @@
1
+class Solution {
2
+public:
3
+ bool canJump(vector<int>& nums) {
4
+ int maxDist = 0;
5
+ for(int i=0;i<nums.size();i++){
6
+ if(i>maxDist) return false;
7
+ maxDist = std::max(maxDist,i+nums[i]);
8
+ }
9
+ return true;
10
11
+};
0 commit comments