LeetCode-Jump Game II
2013-08-03 22:24
302 查看
class Solution { public: int jump(int A[], int n) { // Start typing your C/C++ solution below // DO NOT write int main() function int end = n - 1; int steps = 0; while (end > 0) { for (int i = 0; i < end; ++i) { if (A[i] >= end - i) { ++steps; end = i; break; } } } return steps; } };
相关文章推荐
- Jump Game II - LeetCode
- [LeetCode][JavaScript]Jump Game II
- LeetCode - Jump Game II
- leetcode:Jump Game II
- Leetcode_jump-game-ii(c++ and python version)
- leetcode习题解答:45. Jump Game II
- LeetCode Jump Game II(贪心)
- [LeetCode] Jump Game II
- leetcode 114: Jump Game II
- [LeetCode] Jump Game II
- Jump Game II [leetcode] DP的两种思路
- 【leetcode刷题笔记】Jump Game II
- leetcode—Jump Game II
- LeetCode JumpGame and JumpGame II
- [LeetCode] Jump Game II 贪心
- LeetCode 45 Jump Game II
- leetcode 45. Jump Game II
- LeetCode-jump-game-ii
- [LeetCode] Jump Game II(贪婪算法)
- [LeetCode] Jump Game II