{"id":2571,"date":"2022-02-03T20:37:40","date_gmt":"2022-02-03T12:37:40","guid":{"rendered":"http:\/\/139.9.1.231\/?p=2571"},"modified":"2022-02-03T20:37:42","modified_gmt":"2022-02-03T12:37:42","slug":"leetcodeday118","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/02\/03\/leetcodeday118\/","title":{"rendered":"leetcodeday118&#8211;\u6768\u8f89\u4e09\u89d2"},"content":{"rendered":"\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u975e\u8d1f\u6574\u6570&nbsp;<em><code>numRows<\/code>\uff0c<\/em>\u751f\u6210\u300c\u6768\u8f89\u4e09\u89d2\u300d\u7684\u524d&nbsp;<em><code>numRows<\/code>&nbsp;<\/em>\u884c\u3002<\/p>\n\n\n\n<p><small>\u5728\u300c\u6768\u8f89\u4e09\u89d2\u300d\u4e2d\uff0c\u6bcf\u4e2a\u6570\u662f\u5b83\u5de6\u4e0a\u65b9\u548c\u53f3\u4e0a\u65b9\u7684\u6570\u7684\u548c\u3002<\/small><\/p>\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\/02\/image-22.png\" alt=\"\" class=\"wp-image-2573\" width=\"294\" height=\"248\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-22.png 570w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-22-300x253.png 300w\" sizes=\"(max-width: 294px) 100vw, 294px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165:<\/strong> numRows = 5\n<strong>\u8f93\u51fa:<\/strong> &#91;&#91;1],&#91;1,1],&#91;1,2,1],&#91;1,3,3,1],&#91;1,4,6,4,1]]<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#\r\n# @lc app=leetcode.cn id=118 lang=python3\r\n#\r\n# &#91;118] \u6768\u8f89\u4e09\u89d2\r\n#\r\n\r\n# @lc code=start\r\nclass Solution:\r\n    def generate(self, numRows: int) -> List&#91;List&#91;int]]:\r\n        nums=&#91;]\r\n        for i in range(numRows):\r\n            if i==0:\r\n                nums.append(&#91;1])\r\n            elif i==1:\r\n                nums.append(&#91;1,1])\r\n            else:\r\n                m=list()\r\n                for j in range(len(nums&#91;i-1])-1):\r\n                    m.append(nums&#91;i-1]&#91;j]+nums&#91;i-1]&#91;j+1])\r\n                nums.append(&#91;1]+m+&#91;1])\r\n        return nums\r\n# @lc code=end\r\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" width=\"972\" height=\"231\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-21.png\" alt=\"\" class=\"wp-image-2572\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-21.png 972w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-21-300x71.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-21-768x183.png 768w\" sizes=\"(max-width: 972px) 100vw, 972px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u5b9a\u4e00\u4e2a\u975e\u8d1f\u6574\u6570&nbsp;numRows\uff0c\u751f\u6210\u300c\u6768\u8f89\u4e09\u89d2\u300d\u7684\u524d&nbsp;numRows&nbsp;\u884c\u3002 \u5728 &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/02\/03\/leetcodeday118\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leetcodeday118&#8211;\u6768\u8f89\u4e09\u89d2<\/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\/2571"}],"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=2571"}],"version-history":[{"count":1,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2571\/revisions"}],"predecessor-version":[{"id":2574,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2571\/revisions\/2574"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=2571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=2571"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=2571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}