当前位置:网站首页>Leetcode 55 jump game
Leetcode 55 jump game
2022-06-12 01:44:00 【baj001】
Ideas
- To jump to the last position , It's just calculation : Whether the jump coverage can cover the end point
- Use for Continuous cycle to update stay Current coverage Of New coverage
- If it appears Coverage ( That is, the maximum reachable index position ) Greater than or equal to Array of End index position when , explain : You can reach by jumping , return true
// Whether the jump coverage can cover the end point or not
class Solution {
public boolean canJump(int[] nums) {
if(nums.length == 1){
return true;
}
// The definition coverage is initially defined as 0
int coverRange = 0;
// Update the maximum coverage within the coverage , Coverage is actually the maximum reachable index location
for(int i = 0; i <= coverRange; i++){
coverRange = Math.max(coverRange, i + nums[i]);
if(coverRange >= nums.length - 1){
return true;
}
}
return false;
}
}
边栏推荐
- Data in the assembly cannot start with a letter! 0 before the beginning of a letter
- Watermelon video synchronization Tiktok also has benefits ~ the official "China Video Partner Program"
- Redis實現消息隊列的4種方案
- 括号生成(回溯)
- Three times a day (in serial...)
- State Administration of market supervision and state Internet Information Office: carry out data security management certification
- "It's safer to learn a skill!" The little brother of Hangzhou campus changes to software testing, and likes to mention 10k+ weekend!
- Prism框架初识-模块化介绍
- Program environment and pretreatment
- Wechat applet - a case of comparing the size of numbers
猜你喜欢

Image retrieval based on cross modal AI model
![[n32g457] remote monitoring of graffiti cloud based on RT thread and n32g457](/img/c3/5c9970d7e77afce925814d0ecd3b96.jpg)
[n32g457] remote monitoring of graffiti cloud based on RT thread and n32g457

华为,这也太强了吧..

New knowledge: monkey improved app crawler

Design practice of rongyun Im on electron platform

“還是學一門技術更保險!”杭州校區小哥哥轉行軟件測試,喜提10K+雙休!

The resignation of the chief oracle engineer was furious: MySQL is a terrible database, so it is recommended to consider PostgreSQL!

Pyinstaller packaging Exe (detailed tutorial)

【项目实训】校验注解

2022 blind box applet app has become a new drainage outlet for enterprises
随机推荐
2022 blind box applet app has become a new drainage outlet for enterprises
[project training] wechat official account template message push
php安全开发 12博客系统的 系统模块信息的修改
MATLAB basic application 02 wind stock data introduction and use case:
Kmeans from 0 to 1
【项目实训】微信公众号获取用户openid
关于vagrant up的一个终结之谜
[popular science video] what is a lens antenna?
Applets 111111
A summary of the interface automation test problems most easily encountered
Common assertions for JMeter interface testing
Simplified interpretation of accuracy and recall in AI papers
"Xilin chain" of Southwest Forestry University passed the functional test of Electronic Standards Institute of the Ministry of industry and information technology | FISCO bcos case
The road of global evolution of vivo global mall -- multilingual solution
西南林业大学“西林链”通过工信部电子标准院功能测试 | FISCO BCOS案例
Ce soir - là, j'ai battu mon collègue...
JSON conversion: entity classes and jsonobject are converted to each other, and list and jsonarray are converted to each other (fastjson version)
实体类DTO转VO通过插件转化
State Administration of market supervision and state Internet Information Office: carry out data security management certification
Data in the assembly cannot start with a letter! 0 before the beginning of a letter