diff --git a/arrays/jumpgame.cpp b/arrays/jumpgame.cpp new file mode 100644 index 0000000..5a3ccd4 --- /dev/null +++ b/arrays/jumpgame.cpp @@ -0,0 +1,13 @@ +class Solution { +public: + bool canJump(vector& nums) { + int maxIndex = 0; + for(int i=0; i maxIndex){ + return false; + } + maxIndex = max(maxIndex, i + nums[i]); + } + return true; + } +};