Jump Game(C++)
class Solution {
public:
bool isJumpable = false;
bool canJump(vector<int>& nums) {
int distance = 0;
for(vector<int>::iterator it = nums.end() - 1 ; it >= nums.begin(); it--,distance++){
if(*it >= distance){
distance = 0;
}
if(it == nums.begin() && *it >= distance)
return true;
}
return false;
}
};
相關文章
- Leetcode jump GameLeetCodeGAM
- LeetCode 55 Jump GameLeetCodeGAM
- [LeetCode] Jump Game IILeetCodeGAM
- Leetcode jump Game IILeetCodeGAM
- Leetcode-Jump GameLeetCodeGAM
- Jump Game leetcode javaGAMLeetCodeJava
- Leetcode-Jump Game IILeetCodeGAM
- Jump Game II leetcode javaGAMLeetCodeJava
- [LeetCode] 55. Jump GameLeetCodeGAM
- 55-jump Game 跳躍遊戲GAM遊戲
- [LeetCode] 45. Jump Game IILeetCodeGAM
- 【Leetcode】1340. Jump Game V 【動態規劃/記憶性搜尋】LeetCodeGAM動態規劃
- 【leetcode】45. Jump Game II 非負陣列的最少跳躍步數LeetCodeGAM陣列
- 12、C++ Switch的使用問題error: jump to case labelC++Error
- java GameJavaGAM
- Wooden GameGAM
- Card GameGAM
- Shop GameGAM
- CF1768F Wonderful Jump 題解
- Fast Car GameASTGAM
- Infinite Card GameGAM
- game development -- flowGAMdev
- 《JUMP》中最強的好女人角色排行TOP 10
- Flip Game(POJ 1753)GAM
- E. Wooden GameGAM
- C. Game on PermutationGAM
- D. Shop GameGAM
- HDU 1729 Stone GameGAM
- C. Game MasterGAMAST
- FZU 2275 Game (KMP)GAMKMP
- Switch Game HDU - 2053GAM
- A Multiplication Game (博弈,規律)GAM
- HTML5 game enginesHTMLGAM
- LeetCode:Game of LifeLeetCodeGAM
- D. Soldier and Number GameGAM
- Shooter Game User Interface StarterGAM
- C. MEX Game 1GAM
- Xcode 9 快速跳轉到定義新姿勢(Jump to Definition)XCode