55. Jump Game(贪心)
来源:互联网 发布:json 对日期格式化 编辑:程序博客网 时间:2024/06/10 05:48
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are able to reach the last index.For example:A = [2,3,1,1,4], return true.A = [3,2,1,0,4], return false.
class Solution {public: bool canJump(vector<int>& nums) { int index = 0, size = nums.size(); for(int reach=0; index<size && index<=reach; ++index) reach = std::max(index+nums[index], reach); return index == size; }};
0 0
- 55. Jump Game(贪心)
- 55. Jump Game(贪心)
- 55. Jump Game(贪心)
- 55. Jump Game(dp, 贪心)
- [leetcode]55. Jump Game 贪心
- leetcode 55. Jump Game [贪心]
- leetcode 55. Jump Game-贪心算法
- LeetCode 55. Jump Game|贪心算法
- leetcode.55.Jump Game(medium)[贪心算法]
- leetcode 55. Jump Game 贪心算法
- 55. Jump Game 【Medium】 贪心算法
- LeetCode 之 Jump Game(贪心算法)
- 45. Jump Game II (贪心)
- Leetcode 贪心 Jump Game
- Jump Game 贪心
- 贪心 Jump Game II
- [leetcode][贪心] Jump Game
- leetcode---Jump Game---贪心
- eclipse中配置tomcat
- PAT乙级1061 判断题
- Unity中实现Hololens的三维空间映射Spatial mapping
- jquery 解决使用append添加元素后监听事件消失的问题
- 2017.02.22:利用python进行数据分析
- 55. Jump Game(贪心)
- WebCollector Maven支持(含所有依赖jar包)
- 市场需求分析(MRD)模板
- ArcGIS Engine中如何往已有要素类中插入数据
- css梯形、六角星、五角星、六边形
- 默认情况下从svn checkout项目报错解决方法
- 解读Netty之接收缓冲区
- runtime 实现nscoding
- Linux命令行