LeetCode(力扣)55. 跳跃游戏Python

LeetCode20. 有效的括号

题目链接

https://leetcode.cn/problems/jump-game/

代码

python 复制代码
class Solution:
    def canJump(self, nums: List[int]) -> bool:
        if len(nums) <= 1:
            return True
        cover = 0
        for i in range(len(nums)):
            if i <= cover:
                cover = max(cover, i + nums[i])
                if cover >= len(nums) - 1:
                    return True
        return False
相关推荐
Predestination王瀞潞10 分钟前
Python oct() 函数
开发语言·python
B站_计算机毕业设计之家29 分钟前
python汽车数据分析可视化系统 爬虫 懂车帝 毕业设计 Django框架 vue框架 大数据✅
爬虫·python·数据分析·django·汽车·推荐算法·懂车帝
fl17683130 分钟前
基于python+tkinter实现的自动组卷评卷考试系统python源码+课程设计+项目说明
开发语言·python·课程设计
王琦031834 分钟前
Python 综合大作业
python
Dxy12393102161 小时前
Python自动连接已保存WiFi
开发语言·python
依旧很淡定1 小时前
Selenium(Python)创建Chrome浏览器实例
chrome·python·selenium
中文Python2 小时前
小白中文Python-db_桌面小黄鸭宠物
数据库·python·pygame·宠物·中文python·小白学python
MoRanzhi12033 小时前
12. Pandas 数据合并与拼接(concat 与 merge)
数据库·人工智能·python·数学建模·矩阵·数据分析·pandas
未知陨落3 小时前
LeetCode:95.编辑距离
算法·leetcode