{"id":3772,"date":"2023-10-30T15:30:07","date_gmt":"2023-10-30T07:30:07","guid":{"rendered":"https:\/\/white-night.club\/?p=3772"},"modified":"2023-11-09T11:07:45","modified_gmt":"2023-11-09T03:07:45","slug":"ad113","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/10\/30\/ad113\/","title":{"rendered":"119.\u00a0\u6768\u8f89\u4e09\u89d2 II"},"content":{"rendered":"\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u975e\u8d1f\u7d22\u5f15&nbsp;<code>rowIndex<\/code>\uff0c\u8fd4\u56de\u300c\u6768\u8f89\u4e09\u89d2\u300d\u7684\u7b2c&nbsp;<code>rowIndex<\/code><em>&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> rowIndex = 3\n<strong>\u8f93\u51fa:<\/strong> [1,3,3,1]\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> rowIndex = 0\n<strong>\u8f93\u51fa:<\/strong> [1]\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 3:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165:<\/strong> rowIndex = 1\n<strong>\u8f93\u51fa:<\/strong> [1,1]\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a:<\/strong><\/p>\n\n\n\n<ul>\n<li><code>0 &lt;= rowIndex &lt;= 33<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>\u8fdb\u9636\uff1a<\/strong><\/p>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u4f18\u5316\u4f60\u7684\u7b97\u6cd5\u5230&nbsp;<code><em>O<\/em>(<em>rowIndex<\/em>)<\/code>&nbsp;\u7a7a\u95f4\u590d\u6742\u5ea6\u5417\uff1f<\/p>\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>\u5148\u7528\u52a8\u6001\u89c4\u5212\u5199\u4e0b\u3002\u53ea\u80fd\u8bf4\u5199\u7684\u8fd8\u662f\u4e0d\u591f\u591a\uff0c\u770b\u4e86\u4e0b\u4ee5\u524d\u7684\u601d\u8def\u624d\u505a\u51fa\u6765\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\npublic:\n    vector&lt;int&gt; getRow(int rowIndex) {\n        vector&lt;vector&lt;int&gt;&gt;result(rowIndex+1);\n        for(int i=0;i&lt;=rowIndex;i++)\n        {\n            result&#91;i].resize(rowIndex+1);\n            result&#91;i]&#91;0]=result&#91;i]&#91;i]=1;\n            for(int j=1;j&lt;rowIndex;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&#91;rowIndex];\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\/3772"}],"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=3772"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/3772\/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=3772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=3772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=3772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}