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
相关推荐
想吃火锅10053 分钟前
【leetcode】189.轮转数组js
开发语言·javascript·leetcode
郝学胜-神的一滴4 分钟前
AI 编程智能体 02:AI智能体到底是什么
开发语言·人工智能·python·程序人生·pycharm
Guarding and trust11 分钟前
python系列之多线程编程
python
梅雅达编程笔记32 分钟前
03_网页表格数据抓取
爬虫·python·beautifulsoup·pandas·数据采集
迅猛龙办公室33 分钟前
Python实现求两个数字之和
java·开发语言·python
企业数字化笔记44 分钟前
视频成片怎么稳定导出?编码选择、GPU/CPU降级与媒体交付验收
java·python·ffmpeg
szial1 小时前
网络爬虫与 CDP 实战(一):网页数据到底在哪?从 HTTP 到分页采集
网络·爬虫·python·网络爬虫
DanCheng-studio2 小时前
智能科学与技术毕设易上手题目建议
python·毕业设计·毕设
醇氧2 小时前
nohup 后台启动 uvicorn(仅测试 / 临时运行)
linux·运维·网络·python·python3.11
All for pursuit.2 小时前
【贪心-2】253.会议室 II
数据结构·c++·算法·leetcode