{"id":2949,"date":"2020-02-17T13:35:28","date_gmt":"2020-02-17T05:35:28","guid":{"rendered":"http:\/\/www.sniper97.cn\/?p=2949"},"modified":"2020-02-17T13:35:28","modified_gmt":"2020-02-17T05:35:28","slug":"%e3%80%90leetcode%e3%80%910055-%e8%b7%b3%e8%b7%83%e6%b8%b8%e6%88%8f","status":"publish","type":"post","link":"http:\/\/www.sniper97.cn\/index.php\/note\/algorithm\/2949\/","title":{"rendered":"\u3010LeetCode\u30110055 \u8df3\u8dc3\u6e38\u620f"},"content":{"rendered":"\n<p><a href=\"https:\/\/leetcode-cn.com\/problems\/jump-game\/\">https:\/\/leetcode-cn.com\/problems\/jump-game\/<\/a><\/p>\n\n\n<pre class=\"wp-block-preformatted\"># -*- coding:utf-8 -*-\n<em>\n<\/em>class Solution(object):\n    def canJump(self, nums):\n        <em>\"\"\"\n        <\/em><strong><em>:type<\/em><\/strong><em> nums: List[int]\n        <\/em><strong><em>:rtype<\/em><\/strong><em>: bool\n        \"\"\"\n        <\/em>start = 0\n        end = 0\n        n = len(nums)\n        while start &lt;= end and end &lt; len(nums) - 1:\n            end = max(end, nums[start] + start)\n            start += 1\n        return end >= n - 1\nif __name__ == '__main__':\n    nums = [3, 2, 1, 0, 4]\n    print(Solution().canJump(nums))\n<\/pre>\n\n\n<p><strong>\u601d\u8def<\/strong>\uff1a\u6807\u8bb0\u4e00\u4e2a\u6700\u8fdc\u8df3\u8dc3\u8ddd\u79bb\uff0c\u4f9d\u6b21\u5224\u65ad\u5f53\u524d\u4f4d\u7f6e\u52a0\u4e0a\u5f53\u524d\u4f4d\u7f6e\u6700\u8fdc\u8df3\u8dc3\u8ddd\u79bb\u6709\u6ca1\u6709\u8d85\u8fc7\u6700\u8fdc\u8ddd\u79bb\uff0c\u5728\u904d\u5386\u5b8c\u6240\u6709\u70b9\u4e4b\u540e\u5224\u65ad\u6700\u8fdc\u8ddd\u79bb\u5927\u4e0d\u5927\u4e8e\u6570\u7ec4\u957f\u5ea6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/leetcode-cn.com\/problems\/jump-game\/ # -*-  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"views":1506,"_links":{"self":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/2949"}],"collection":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2949"}],"version-history":[{"count":0,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/2949\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2949"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2949"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2949"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}