diff --git a/DSA Problems Dynamic Programming/06_Jump_Game.cpp b/DSA Problems Dynamic Programming/06_Jump_Game.cpp new file mode 100644 index 0000000..a63c1ba --- /dev/null +++ b/DSA Problems Dynamic Programming/06_Jump_Game.cpp @@ -0,0 +1,19 @@ +class Solution { + vector memo; + public: + bool canJump(vector& nums) { + int n=nums.size(); + vector dp(n,0); + dp[0]=true; + + for(int i=1;i=0;j--){ + if(dp[j] && j+nums[j]>=i){ + dp[i]=true; + break; + } + } + } + return dp[n-1]; + } +};