{"id":2821,"date":"2023-10-18T10:38:25","date_gmt":"2023-10-18T02:38:25","guid":{"rendered":"https:\/\/white-night.club\/?p=2821"},"modified":"2023-11-09T11:07:48","modified_gmt":"2023-11-09T03:07:48","slug":"ad73","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/18\/ad73\/","title":{"rendered":"118.\u00a0\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<figure class=\"wp-block-image aligncenter has-custom-border\"><img decoding=\"async\" src=\"https:\/\/pic.leetcode-cn.com\/1626927345-DZmfxB-PascalTriangleAnimated2.gif\" alt=\"\" style=\"border-style:none;border-width:0px;border-radius:0px\"\/><\/figure>\n\n\n\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> numRows = 5\n<strong>\u8f93\u51fa:<\/strong> [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b&nbsp;2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> numRows = 1\n<strong>\u8f93\u51fa:<\/strong> [[1]]\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a:<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= numRows &lt;= 30<\/code><\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u52a8\u6001\u89c4\u5212<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u5177\u4f53\u9898\u89e3\u5199\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e86\uff1a<a href=\"https:\/\/white-night.club\/index.php\/2023\/10\/18\/ad72\/\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0086ff\" class=\"has-inline-color\">\u6768\u8f89\u4e09\u89d2\uff1a\u52a8\u6001\u89c4\u5212<\/mark><\/a>\u3002\u8fd9\u91cc\u5c31\u4e0d\u4f5c\u8fc7\u591a\u89e3\u91ca\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\npublic:\n    vector&lt;vector&lt;int&gt;&gt; generate(int numRows) {\n        vector&lt;vector&lt;int&gt;&gt; result(numRows);\n        for(int i=0;i&lt;numRows;i++)\n        {\n            result&#91;i].resize(i+1);\n            result&#91;i]&#91;0]=result&#91;i]&#91;i]=1;\n            for(int j=1;j&lt;i;j++)\n            {\n                if(i&gt;=2)\n                {\n                    result&#91;i]&#91;j]=result&#91;i-1]&#91;j-1]+result&#91;i-1]&#91;j];\n                }\n            }\n        }\n        return result;\n    }\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u52a8\u6001\u89c4\u5212<\/p>\n","protected":false},"author":1,"featured_media":2850,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2821"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=2821"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/2821\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2850"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=2821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=2821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=2821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}