{"id":2341,"date":"2022-01-24T11:12:27","date_gmt":"2022-01-24T03:12:27","guid":{"rendered":"http:\/\/139.9.1.231\/?p=2341"},"modified":"2022-01-24T11:12:28","modified_gmt":"2022-01-24T03:12:28","slug":"leetcodeday70","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/01\/24\/leetcodeday70\/","title":{"rendered":"leetcodeday70 &#8211;\u722c\u697c\u68af"},"content":{"rendered":"\n<p>\u5047\u8bbe\u4f60\u6b63\u5728\u722c\u697c\u68af\u3002\u9700\u8981&nbsp;<code>n<\/code>&nbsp;\u9636\u4f60\u624d\u80fd\u5230\u8fbe\u697c\u9876\u3002<\/p>\n\n\n\n<p>\u6bcf\u6b21\u4f60\u53ef\u4ee5\u722c&nbsp;<code>1<\/code>&nbsp;\u6216&nbsp;<code>2<\/code>&nbsp;\u4e2a\u53f0\u9636\u3002\u4f60\u6709\u591a\u5c11\u79cd\u4e0d\u540c\u7684\u65b9\u6cd5\u53ef\u4ee5\u722c\u5230\u697c\u9876\u5462\uff1f<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>n = 2\n<strong>\u8f93\u51fa\uff1a<\/strong>2\n<strong>\u89e3\u91ca\uff1a<\/strong>\u6709\u4e24\u79cd\u65b9\u6cd5\u53ef\u4ee5\u722c\u5230\u697c\u9876\u3002\n1. 1 \u9636 + 1 \u9636\n2. 2 \u9636<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>n = 3\n<strong>\u8f93\u51fa\uff1a<\/strong>3\n<strong>\u89e3\u91ca\uff1a<\/strong>\u6709\u4e09\u79cd\u65b9\u6cd5\u53ef\u4ee5\u722c\u5230\u697c\u9876\u3002\n1. 1 \u9636 + 1 \u9636 + 1 \u9636\n2. 1 \u9636 + 2 \u9636\n3. 2 \u9636 + 1 \u9636\n<\/pre>\n\n\n\n<p>\u52a8\u6001\u89c4\u5212 or \u9012\u5f52<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># @lc app=leetcode.cn id=70 lang=python3\r\n#\r\n# &#91;70] \u722c\u697c\u68af\r\n#\r\n\r\n# @lc code=start\r\nclass Solution:\r\n    def climbStairs(self, n: int) -> int:\r\n        dp=&#91;0 for i in range(n)]\r\n        \r\n        for i in range(n):\r\n            if i == 0:\r\n                dp&#91;0]=1\r\n                continue\r\n            if i == 1:\r\n                dp&#91;1]=2\r\n                continue\r\n            dp&#91;i]=dp&#91;i-1]+dp&#91;i-2]\r\n        return dp&#91;n-1]<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-281.png\" alt=\"\" class=\"wp-image-2343\" width=\"393\" height=\"158\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-281.png 649w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-281-300x121.png 300w\" sizes=\"(max-width: 393px) 100vw, 393px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5047\u8bbe\u4f60\u6b63\u5728\u722c\u697c\u68af\u3002\u9700\u8981&nbsp;n&nbsp;\u9636\u4f60\u624d\u80fd\u5230\u8fbe\u697c\u9876\u3002 \u6bcf\u6b21\u4f60\u53ef\u4ee5\u722c&nbsp;1&nbsp;\u6216&#038; &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/01\/24\/leetcodeday70\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leetcodeday70 &#8211;\u722c\u697c\u68af<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2341"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=2341"}],"version-history":[{"count":2,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2341\/revisions"}],"predecessor-version":[{"id":2344,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2341\/revisions\/2344"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=2341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=2341"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=2341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}