{"id":101273,"date":"2026-09-06T15:17:07","date_gmt":"2026-09-06T07:17:07","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/101273.html"},"modified":"2026-09-06T15:17:07","modified_gmt":"2026-09-06T07:17:07","slug":"%e3%80%90%e7%ae%97%e6%b3%95%e3%80%91%e5%9b%9e%e6%ba%af%e7%ae%97%e6%b3%95%ef%bc%88%e4%b8%89%ef%bc%89%ef%bc%9a%e4%b8%89%e8%ae%b0%e9%87%8d%e9%94%a4%e4%b8%8e-n-%e7%9a%87%e5%90%8e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/101273.html","title":{"rendered":"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597"},"content":{"rendered":"<h2>\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e09&#xff09;&#xff1a;\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597<\/h2>\n<h3>\u6458\u8981<\/h3>\n<p>\u56de\u6eaf\u7cfb\u5217\u7b2c\u4e09\u7bc7&#xff0c;\u6536\u5b98\u3002\u4e0a\u4e00\u7bc7\u4ee5 LC842 \u9a8c\u6536&#034;\u6bd5\u4e1a&#034;&#xff0c;\u6211\u4ee5\u4e3a\u771f\u6bd5\u4e1a\u4e86\u2014\u2014\u63a5\u4e0b\u6765\u4e09\u8bb0\u91cd\u9524\u9524\u9192\u4e86\u68a6&#xff1a;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#xff08;417 \u4e07\u6b21\u8c03\u7528 vs 176 \u6b21&#xff0c;\u7f13\u5b58\u9009\u62e9\u3001\u7f13\u5b58\u5019\u9009\u3001\u53ea\u5199\u4e0d\u8bfb\u4e00\u8def\u8e29\u8fc7\u53bb&#xff09;\u3001\u6392\u5e8f\u88ab\u7981\u540e\u7684\u53bb\u91cd&#xff08;\u5c42\u5c5e\u6027 vs \u8def\u5f84\u5c5e\u6027&#xff0c;usedThisLevel \u4e0d\u8fd8\u539f\u662f\u7cbe\u9ad3&#xff09;\u3001\u4e2d\u95f4\u6001\u5931\u63a7&#xff08;\u628a Go \u7684\u6808\u6491\u7206 1GB&#xff09;\u3002\u4e09\u9524\u5168\u90e8\u6307\u5411\u540c\u4e00\u4ef6\u4e8b&#xff1a;\u72b6\u6001\u8bbe\u8ba1\u3002\u6700\u540e\u7528 N \u7687\u540e\u6536\u5b98&#xff08;\u5bf9\u89d2\u7ebf\u7f16\u53f7 r\u00b1c &#043; \u4e09\u4e2a\u6807\u8bb0\u6570\u7ec4 &#043; \u56db\u52a8\u4f5c\u5bf9&#xff09;&#xff0c;\u5e76\u628a\u6574\u4e2a\u7cfb\u5217\u6c89\u6dc0\u6210\u4e09\u5c42\u6f0f\u6597\u8bc6\u522b\u6846\u67b6\u548c\u5199\u9898\u524d\u7684\u7ec8\u6781\u68c0\u67e5\u6e05\u5355\u3002\u672c\u7bc7\u4e5f\u662f\u901a\u5f80\u52a8\u6001\u89c4\u5212\u7684\u6865\u2014\u2014\u8bb0\u5fc6\u5316\u7684\u5224\u636e&#xff0c;\u5c31\u662f DP \u7684\u5165\u573a\u5238\u3002<\/p>\n<p>\u8bf4\u660e&#xff0c;\u4ee5\u4e0b\u73af\u5883\u57fa\u4e8e go1.21&#043;&#xff0c;\u9898\u76ee\u5747\u6765\u81ea LeetCode\u3002\u524d\u7f6e\u9605\u8bfb&#xff1a;\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e00&#xff09;&#xff1a;\u4ece\u4e00\u9053 IP \u9898\u5230\u4e07\u80fd\u6a21\u677f\u3001\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e8c&#xff09;&#xff1a;\u4e94\u4e2a\u5751\u4e0e\u4e00\u6b21\u9a8c\u6536\u3002\u914d\u5957\u4ee3\u7801\u4ed3\u5e93&#xff08;\u6309\u9898\u53f7\u5206\u76ee\u5f55&#xff09;&#xff1a;https:\/\/github.com\/a18792721831\/studyleetCode<\/p>\n<p>\u7cfb\u5217\u7bc7\u76ee&#xff1a;<\/p>\n<ul>\n<li>\u4e00\u3001\u4ece\u4e00\u9053 IP \u9898\u5230\u4e07\u80fd\u6a21\u677f<\/li>\n<li>\u4e8c\u3001\u4e94\u4e2a\u5751\u4e0e\u4e00\u6b21\u9a8c\u6536\u2014\u2014\u51b3\u7b56\u3001\u5207\u7247\u4e0e\u53bb\u91cd<\/li>\n<li>\u4e09\u3001\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597&#xff08;\u672c\u7bc7&#xff09;<\/li>\n<\/ul>\n<h4>\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e09&#xff09;&#xff1a;\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597<\/h4>\n<ul>\n<li>\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e09&#xff09;&#xff1a;\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597<\/li>\n<li>\n<ul>\n<li>\u6458\u8981<\/li>\n<li>1. \u7ffb\u8f66\u516d&#xff1a;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#xff08;LC139 \u8d85\u65f6 \u2192 LC140 \u4e24\u8fde\u5751&#xff09;<\/li>\n<li>\n<ul>\n<li>1.1 \u7b2c\u4e00\u6b21\u9519\u4f4d&#xff1a;\u4e0d\u77e5\u9053\u8981\u8bb0\u5fc6<\/li>\n<li>1.2 \u7b2c\u4e8c\u6b21\u9519\u4f4d&#xff1a;memo \u5b58\u4e86&#034;\u4e00\u4e2a\u9009\u62e9&#034;<\/li>\n<li>1.3 \u7b2c\u4e09\u6b21\u9519\u4f4d&#xff1a;memo \u5b58\u4e86&#034;\u5019\u9009\u8bcd\u5217\u8868&#034;<\/li>\n<li>1.4 \u5224\u636e&#xff1a;\u7f13\u5b58\u7ed3\u8bba&#xff0c;\u4e0d\u7f13\u5b58\u9009\u62e9<\/li>\n<\/ul>\n<\/li>\n<li>2. \u7ffb\u8f66\u4e03&#xff1a;\u6392\u5e8f\u88ab\u7981\u4e4b\u540e&#xff08;LC491 \u9012\u589e\u5b50\u5e8f\u5217&#xff09;<\/li>\n<li>\n<ul>\n<li>2.1 \u6392\u5e8f\u7684\u771f\u6b63\u89d2\u8272<\/li>\n<li>2.2 \u5c42\u5c5e\u6027 vs \u8def\u5f84\u5c5e\u6027<\/li>\n<li>2.3 \u53bb\u91cd\u56db\u4ef6\u5957\u96c6\u9f50<\/li>\n<\/ul>\n<\/li>\n<li>3. \u7ffb\u8f66\u516b&#xff1a;\u4e2d\u95f4\u6001\u5931\u63a7&#xff08;LC79 \u5355\u8bcd\u641c\u7d22&#xff09;<\/li>\n<li>\n<ul>\n<li>3.1 \u75c5\u6839&#xff1a;\u79fb\u52a8\u548c\u5339\u914d\u88ab\u62c6\u6210\u4e86\u4e24\u4e2a\u9012\u5f52<\/li>\n<li>3.2 \u4fee\u590d&#xff1a;\u79fb\u52a8\u5373\u5339\u914d&#xff0c;\u6d88\u706d\u4e2d\u95f4\u6001<\/li>\n<li>3.3 \u7c92\u5ea6\u7684\u4e24\u4e2a\u65b9\u5411<\/li>\n<li>3.4 \u51b3\u7b56\u8bbe\u8ba1\u56db\u68c0\u9a8c&#xff08;\u4e09\u9a8c\u8bc1\u5347\u7ea7\u7248&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>4. \u72b6\u6001\u8bbe\u8ba1\u6536\u5b98&#xff1a;N \u7687\u540e&#xff08;LC51&#xff09;<\/li>\n<li>\n<ul>\n<li>4.1 \u9aa8\u67b6&#xff1a;\u6bcf\u5c42\u4e00\u884c&#xff0c;\u4e00\u6b21\u8c03\u7528<\/li>\n<li>4.2 \u5bf9\u89d2\u7ebf\u7684\u6570\u5b66&#xff1a;\u8fd9\u9898\u7684\u7075\u9b42<\/li>\n<li>4.3 \u4e09\u4e2a\u6807\u8bb0\u6570\u7ec4 &#043; \u56db\u52a8\u4f5c\u5bf9<\/li>\n<li>4.4 &#034;\u6298\u53e0\u5224\u65ad&#034;\u7684\u7b2c\u56db\u6b21\u767b\u573a<\/li>\n<\/ul>\n<\/li>\n<li>5. \u8bc6\u522b\u6846\u67b6&#xff1a;\u4e09\u5c42\u6f0f\u6597<\/li>\n<li>\n<ul>\n<li>5.1 \u7b2c\u4e00\u5c42&#xff1a;\u8303\u5f0f\u95f8\u95e8&#xff08;\u662f\u4e0d\u662f\u56de\u6eaf&#xff09;<\/li>\n<li>5.2 \u7b2c\u4e8c\u5c42&#xff1a;\u5bb6\u65cf\u95f8\u95e8&#xff08;\u7528\u54ea\u4e2a\u9aa8\u67b6&#xff09;<\/li>\n<li>5.3 \u7b2c\u4e09\u5c42&#xff1a;\u5ef6\u4f38\u6a21\u5757\u626b\u63cf&#xff08;\u52a0\u4ec0\u4e48\u88c5\u5907&#xff09;<\/li>\n<li>5.4 \u5b9e\u64cd\u6d41\u7a0b&#xff1a;\u8fed\u4ee3\u5f0f<\/li>\n<\/ul>\n<\/li>\n<li>6. \u7ec8\u6781\u68c0\u67e5\u6e05\u5355<\/li>\n<li>\u603b\u7ed3<\/li>\n<li>\u53c2\u8003\u8d44\u6599<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>1. \u7ffb\u8f66\u516d&#xff1a;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#xff08;LC139 \u8d85\u65f6 \u2192 LC140 \u4e24\u8fde\u5751&#xff09;<\/h3>\n<h4>1.1 \u7b2c\u4e00\u6b21\u9519\u4f4d&#xff1a;\u4e0d\u77e5\u9053\u8981\u8bb0\u5fc6<\/h4>\n<p>\u6211\u81ea\u5df1\u5199 139 \u7684\u56de\u6eaf\u7248&#xff0c;\u6d4b\u8bd5\u7528\u4f8b&#xff1a;130 \u4e2a a &#043; b&#xff0c;\u5b57\u5178\u662f a \u5230 aaaaaaaaaa&#xff08;10 \u79cd\u957f\u5ea6&#xff09;\u3002\u8dd1\u4e86\u534a\u5929\u8dd1\u4e0d\u5b8c&#xff0c;\u7f29\u5c0f\u5230 22 \u4e2a a \u7edf\u8ba1\u8c03\u7528\u6b21\u6570&#xff1a;<\/p>\n<p>22 \u4e2a a &#043; b&#xff1a;<br \/>\n\u7eaf\u56de\u6eaf:   4,169,729 \u6b21\u8c03\u7528<br \/>\n\u8bb0\u5fc6\u5316\u7248:       176 \u6b21<\/p>\n<p>417 \u4e07 vs 176\u3002\u75c5\u6839&#xff1a;\u5b57\u5178\u6709 10 \u79cd\u957f\u5ea6\u7684\u8bcd&#xff0c;\u5207\u5230\u4f4d\u7f6e k \u7684\u8def\u5f84\u6570\u6307\u6570\u589e\u957f&#xff0c;\u800c\u6240\u6709\u8def\u5f84\u5230\u8fbe\u540c\u4e00\u4e2a\u4f4d\u7f6e\u540e\u505a\u7684\u4e8b\u60c5\u5b8c\u5168\u4e00\u6837\u2014\u2014\u201c\u4ece\u4f4d\u7f6e k \u628a\u5269\u4e0b\u7684\u62c6\u5b8c\u201d\u3002\u8fd9\u4e2a\u5b50\u95ee\u9898\u7684\u7b54\u6848\u53ea\u53d6\u51b3\u4e8e k&#xff0c;\u4e0e\u600e\u4e48\u5230\u8fbe\u6beb\u65e0\u5173\u7cfb&#xff0c;\u4f46\u7eaf\u56de\u6eaf\u6bcf\u6761\u8def\u5f84\u5230\u8fbe\u540e\u90fd\u4ece\u5934\u5b8c\u6574\u679a\u4e3e\u4e00\u904d\u3002<\/p>\n<p>\u66f4\u624e\u5fc3\u7684\u662f\u8fd9\u4e2a\u7528\u4f8b\u65e0\u89e3&#xff08;b \u5339\u914d\u4e0d\u4e0a\u4efb\u4f55\u8bcd&#xff09;&#xff0c;\u627e\u5230\u5c31\u77ed\u8def\u8fd4\u56de\u7684\u6280\u5de7\u6551\u4e0d\u4e86\u5b83\u2014\u2014\u5fc5\u987b\u628a\u6574\u4e2a\u641c\u7d22\u7a7a\u95f4\u8d70\u5b8c\u624d\u80fd\u786e\u8ba4\u65e0\u89e3&#xff0c;\u8fd9\u65f6\u5019\u8bb0\u5fc6\u5316\u662f\u552f\u4e00\u7684\u6d3b\u8def&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u4e09\u6001&#xff1a;0&#061;\u6ca1\u7b97\u8fc7 1&#061;\u53ef\u62c6 2&#061;\u4e0d\u53ef\u62c6&#xff08;\u7528 bool \u65e0\u6cd5\u533a\u5206&#034;\u6ca1\u7b97\u8fc7&#034;\u548c&#034;\u7b97\u51fa\u6765\u662f false&#034;&#xff09;<\/span><br \/>\nmemo <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int8<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>s<span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>1.2 \u7b2c\u4e8c\u6b21\u9519\u4f4d&#xff1a;memo \u5b58\u4e86&#034;\u4e00\u4e2a\u9009\u62e9&#034;<\/h4>\n<p>\u5347\u7ea7\u6253 140 \u5355\u8bcd\u62c6\u5206 II&#xff08;\u8981\u6240\u6709\u65b9\u6848&#xff09;\u3002\u7b2c\u4e00\u7248\u6211\u628a memo \u8bbe\u8ba1\u6210 map[int]string\u2014\u2014\u5b58&#034;\u8fd9\u4e2a\u4f4d\u7f6e\u5339\u914d\u5230\u7684\u67d0\u4e2a\u8bcd&#034;\u3002\u6536\u96c6\u65f6\u8fd8\u7528 return \u77ed\u8def&#xff0c;\u7ed3\u679c\u53ea\u627e\u5230\u4e00\u4e2a\u65b9\u6848\u3002<\/p>\n<p>\u4e24\u4e2a\u9519\u8bef&#xff1a;<\/p>\n<li>return \u77ed\u8def\u9519\u4f4d&#xff1a;139 \u7684\u77ed\u8def\u662f\u5bf9\u7684&#xff08;\u53ea\u8981\u53ef\u884c\u6027&#xff09;&#xff0c;140 \u8981\u6240\u6709\u65b9\u6848\u2014\u2014\u6536\u96c6\u5b8c\u5fc5\u987b\u7ee7\u7eed\u679a\u4e3e\u3002\u540c\u4e00\u4e2a&#034;\u627e\u5230\u5c31\u8fd4\u56de&#034;&#xff0c;\u5728\u5b58\u5728\u6027\u641c\u7d22\u91cc\u662f\u4f18\u5316&#xff0c;\u5728\u679a\u4e3e\u641c\u7d22\u91cc\u662f bug<\/li>\n<li>memo \u8bed\u4e49\u9519\u4f4d&#xff1a;\u6211\u5b58\u7684\u662f&#034;\u9009\u4e86\u54ea\u4e2a\u8bcd&#034;&#xff08;\u8fc7\u7a0b&#xff09;&#xff0c;\u800c\u9632\u7206\u70b8\u9700\u8981\u5b58&#034;\u4ece\u8fd9\u51fa\u53d1\u7684\u7ed3\u8bba&#034;\u3002\u524d\u4e00\u4e2a\u76f8\u540c\u503c\u6ca1\u88ab\u9009&#xff08;\u8bf4\u660e\u5b83\u5728\u540c\u5c42\u521a\u88ab\u8bd5\u5b8c\u5f39\u56de&#xff09;&#xff0c;\u6211\u7f13\u5b58\u5b83\u7684&#034;\u9009\u62e9&#034;\u4f1a\u8ba9\u540e\u7eed\u6240\u6709\u8def\u5f84\u90fd\u88ab\u9501\u6b7b\u5728\u540c\u4e00\u4e2a\u8bcd\u4e0a<\/li>\n<h4>1.3 \u7b2c\u4e09\u6b21\u9519\u4f4d&#xff1a;memo \u5b58\u4e86&#034;\u5019\u9009\u8bcd\u5217\u8868&#034;<\/h4>\n<p>\u7b2c\u4e8c\u7248\u6211\u628a memo \u5347\u7ea7\u6210 map[int][]string\u2014\u2014\u5b58&#034;\u8fd9\u4e2a\u4f4d\u7f6e\u80fd\u5339\u914d\u7684\u6240\u6709\u8bcd&#034;\u3002\u6b63\u786e\u6027\u8fbe\u6807\u4e86&#xff0c;\u4f46\u8dd1\u90a3\u4e2a\u65e0\u89e3\u7528\u4f8b&#xff1a;<\/p>\n<p>22 \u4e2a a &#043; b&#xff1a;<br \/>\n\u6211\u7684\u7248\u672c: 4,169,729 \u6b21\u8c03\u7528   \u2190 \u548c\u5b8c\u5168\u6ca1\u6709 memo \u4e00\u6a21\u4e00\u6837&#xff01;<br \/>\nDP \u53ef\u884c\u7248:            2 \u6b21\u8c03\u7528<\/p>\n<p>\u4e00\u4e2a\u6570\u5b57\u90fd\u6ca1\u5dee\u3002\u56e0\u4e3a\u7f13\u5b58\u5019\u9009\u8bcd\u5217\u8868\u540e&#xff0c;\u547d\u4e2d\u7167\u6837\u8981 for \u5faa\u73af\u9012\u5f52\u5168\u90e8\u5019\u9009\u2014\u2014\u5b50\u6811\u8fd8\u662f\u6574\u68f5\u91cd\u641c\u3002\u7701\u6389\u7684\u53ea\u662f&#034;\u91cd\u65b0\u626b\u63cf\u8bcd\u8868\u505a\u5b57\u7b26\u4e32\u5339\u914d&#034;\u7684\u96f6\u94b1&#xff0c;\u6307\u6570\u7ea7\u7684\u8def\u5f84\u679a\u4e3e\u4e00\u5206\u6ca1\u7701\u3002<\/p>\n<h4>1.4 \u5224\u636e&#xff1a;\u7f13\u5b58\u7ed3\u8bba&#xff0c;\u4e0d\u7f13\u5b58\u9009\u62e9<\/h4>\n<p>\u4e09\u6b21\u9519\u4f4d\u4e4b\u540e&#xff0c;\u5224\u636e\u7ec8\u4e8e\u7acb\u4f4f\u4e86&#xff1a;<\/p>\n<p>\u7f13\u5b58\u7684\u4e1c\u897f&#xff0c;\u80fd\u4e0d\u80fd\u8ba9\u540e\u6765\u8005\u8df3\u8fc7\u5b50\u6811\u7684\u5c55\u5f00&#xff1f;<\/p>\n<ul>\n<li>\u5019\u9009\u8bcd\u5217\u8868\u4e0d\u80fd&#xff08;\u9009\u62e9\u8fd8\u8981\u9010\u4e00\u5c55\u5f00&#xff09;<\/li>\n<li>can[end] &#061;&#061; false \u80fd&#xff08;\u6574\u652f\u4e0d\u8fdb&#xff09;<\/li>\n<li>\u53e5\u5b50\u5217\u8868\u80fd&#xff08;\u76f4\u63a5\u62fc\u63a5&#xff09;<\/li>\n<li>\u4e00\u4e2a\u8bcd\u7684&#034;\u9009\u62e9&#034;\u6839\u672c\u662f\u9519\u7684&#xff08;\u9501\u6b7b\u5206\u652f&#xff09;<\/li>\n<\/ul>\n<p>140 \u7684\u6b63\u786e\u59ff\u52bf\u662f\u4e24\u79cd\u4e4b\u4e00&#xff1a;\u5148\u8dd1 139 \u7684 DP \u7b97\u51fa can[]&#xff08;\u4ece idx \u80fd\u5426\u62c6\u5b8c&#xff09;&#xff0c;\u56de\u6eaf\u53ea\u8d70\u6d3b\u8def&#xff08;can[end] \u4e3a false \u7684\u5206\u652f\u4e00\u6b65\u4e0d\u8fdb&#xff09;&#xff1b;\u6216\u8005 memo \u76f4\u63a5\u7f13\u5b58\u5b50\u95ee\u9898\u7684\u5b8c\u6574\u4ea7\u51fa&#xff08;map[int][]string \u5b58&#034;\u4ece idx \u80fd\u62fc\u51fa\u7684\u6240\u6709\u53e5\u5b50&#034;&#xff0c;\u9012\u5f52\u8fd4\u56de\u503c\u76f4\u63a5\u62fc\u63a5&#xff09;\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u4e2a\u66f4\u6df1\u7684\u5224\u636e&#xff0c;\u5224\u65ad\u8fd9\u9053\u9898\u9700\u4e0d\u9700\u8981\u8bb0\u5fc6\u5316\u2014\u2014\u770b\u72b6\u6001\u548c\u8def\u5f84\u7684\u5173\u7cfb&#xff1a;<\/p>\n<ul>\n<li>\u8def\u5f84\u5373\u72b6\u6001&#xff08;\u6392\u5217\/\u7ec4\u5408\/\u5b50\u96c6&#xff09;&#xff1a;\u9009\u62e9\u5e8f\u5217\u672c\u8eab\u5c31\u662f\u72b6\u6001&#xff0c;[1,2] \u548c [2,1] \u662f\u4e24\u4e2a\u4e0d\u540c\u72b6\u6001\u2014\u2014\u6bcf\u6761\u8def\u5f84\u6d3b\u5728\u4e0d\u540c\u7684\u72b6\u6001\u91cc&#xff0c;\u6ca1\u6709\u91cd\u590d\u53ef\u6298\u53e0&#xff0c;\u6c38\u8fdc\u4e0d\u9700\u8981 memo<\/li>\n<li>\u72b6\u6001\u4e0e\u8def\u5f84\u5206\u79bb&#xff08;\u5207\u5206\/\u7f51\u683c\/\u535a\u5f08&#xff09;&#xff1a;\u72b6\u6001\u662f\u805a\u5408\u91cf&#xff08;\u5207\u5230\u54ea\u4e2a\u4f4d\u7f6e\u3001\u8d70\u5230\u54ea\u4e2a\u683c\u5b50\u3001\u5269\u4ec0\u4e48\u5c40\u9762&#xff09;&#xff0c;\u591a\u6761\u8def\u5f84\u574d\u7f29\u5230\u540c\u4e00\u72b6\u6001\u2014\u2014\u91cd\u590d\u8ba1\u7b97\u51fa\u73b0\u4e86&#xff0c;\u8bb0\u5fc6\u5316\u7684\u9776\u5b50<\/li>\n<\/ul>\n<p>\u5148\u95ee&#034;\u6211\u7684\u72b6\u6001\u662f\u4ec0\u4e48&#034;&#xff0c;\u518d\u95ee&#034;\u4e0d\u540c\u8def\u5f84\u4f1a\u574d\u7f29\u5230\u540c\u4e00\u72b6\u6001\u5417&#034;\u2014\u2014\u4f1a&#xff0c;\u5c31\u5fc5\u987b\u60f3\u8bb0\u5fc6\u5316\u3002<\/p>\n<h3>2. \u7ffb\u8f66\u4e03&#xff1a;\u6392\u5e8f\u88ab\u7981\u4e4b\u540e&#xff08;LC491 \u9012\u589e\u5b50\u5e8f\u5217&#xff09;<\/h3>\n<p>\u9012\u589e\u5b50\u5e8f\u5217&#xff1a;\u627e\u51fa\u6240\u6709\u957f\u5ea6 \u22652 \u7684\u975e\u4e25\u683c\u9012\u589e\u5b50\u5e8f\u5217&#xff0c;\u5143\u7d20\u5fc5\u987b\u4fdd\u6301\u539f\u5e8f&#xff0c;\u542b\u91cd\u590d\u5143\u7d20&#xff0c;\u89e3\u4e0d\u80fd\u91cd\u590d\u3002\u8fd9\u9898\u662f\u5757\u8bd5\u91d1\u77f3\u2014\u2014\u5b83\u7981\u6b62\u6392\u5e8f&#xff08;\u6392\u5e8f\u4f1a\u6467\u6bc1&#034;\u5b50\u5e8f\u5217\u6309\u539f\u5e8f\u63d0\u53d6&#034;\u7684\u8bed\u4e49&#xff09;&#xff0c;\u800c\u6211\u5b66\u7684\u540c\u5c42\u53bb\u91cd\u5168\u90e8\u4f9d\u8d56\u6392\u5e8f\u3002<\/p>\n<p>\u6211\u7b2c\u4e00\u7248\u53e0\u4e86\u4e94\u4e2a\u9519\u8bef&#xff0c;\u8f93\u51fa 22 \u4e2a\u7ed3\u679c&#xff08;\u9884\u671f 8&#xff09;&#xff0c;[6,7] \u91cd\u590d 9 \u6b21&#xff1a;<\/p>\n<li>\u6a21\u578b\u6df7\u4e71&#xff1a;\u9009\u4e00\u4e2a\u9aa8\u67b6\u91cc\u53c8\u585e\u4e86\u663e\u5f0f&#034;\u4e0d\u9009&#034;\u5206\u652f\u2014\u2014for \u7684 i \u9012\u589e\u5df2\u7ecf\u5929\u7136\u8868\u8fbe&#034;\u8df3\u8fc7&#034;&#xff0c;\u518d\u52a0\u663e\u5f0f\u8df3\u8fc7\u7b49\u4e8e\u6bcf\u6279\u5b50\u5e8f\u5217\u679a\u4e3e\u4e24\u904d<\/li>\n<li>\u9012\u5f52\u4f20 start&#043;1 \u800c\u4e0d\u662f i&#043;1<\/li>\n<li>\u9012\u589e\u7ea6\u675f\u4e09\u5904\u9519&#xff1a;len(path)&gt;1 \u5e94\u4e3a\u975e\u7a7a\u3001break \u5e94\u4e3a continue&#xff08;\u672a\u6392\u5e8f&#xff01;\u5f53\u524d\u5143\u7d20\u5c0f\u4e0d\u4ee3\u8868\u540e\u9762\u6ca1\u6709\u5927\u7684&#xff09;<\/li>\n<li>\u4e00\u4e2a map \u60f3\u540c\u65f6\u5e72&#034;\u8def\u5f84\u5224\u91cd&#034;\u548c&#034;\u540c\u5c42\u5224\u91cd&#034;\u4e24\u79cd\u8bed\u4e49<\/li>\n<li>nums[i]&#061;&#061;nums[i-1] \u76f8\u90bb\u5224\u91cd\u2014\u2014\u4f9d\u8d56\u6392\u5e8f\u8ba9\u76f8\u540c\u503c\u76f8\u90bb&#xff0c;\u8fd9\u91cc\u5931\u6548<\/li>\n<h4>2.1 \u6392\u5e8f\u7684\u771f\u6b63\u89d2\u8272<\/h4>\n<p>\u649e\u5b8c\u5899\u624d\u60f3\u901a&#xff1a;\u6392\u5e8f\u5728\u540c\u5c42\u53bb\u91cd\u91cc\u7684\u552f\u4e00\u89d2\u8272 &#061; \u8ba9\u76f8\u540c\u503c\u76f8\u90bb&#xff0c;\u4ece\u800c\u7528&#034;\u548c\u524d\u4e00\u4e2a\u6bd4\u8f83&#034;\u8fd9\u4e2a O(1) \u624b\u6bb5\u53d1\u73b0&#034;\u672c\u5c42\u53c8\u9047\u5230\u540c\u4e00\u4e2a\u503c&#034;\u3002\u5b83\u4ece\u6765\u4e0d\u662f\u4e3a\u4e86\u53bb\u91cd\u672c\u8eab&#xff0c;\u53ea\u662f\u53bb\u91cd\u7684&#034;\u53d1\u73b0\u624b\u6bb5&#034;\u3002\u7981\u6b62\u6392\u5e8f\u540e&#xff0c;\u53d1\u73b0\u624b\u6bb5\u6362\u6210\u54c8\u5e0c\u96c6\u5408\u2014\u2014\u4e0d\u4f9d\u8d56\u76f8\u90bb&#xff0c;\u76f4\u63a5\u67e5&#034;\u8fd9\u4e2a\u503c\u672c\u5c42\u8bd5\u8fc7\u6ca1&#034;\u3002\u672c\u8d28\u4ece\u6ca1\u53d8\u8fc7&#xff1a;\u540c\u5c42\u540c\u503c&#xff0c;\u53ea\u8d70\u7b2c\u4e00\u4e2a\u3002<\/p>\n<h4>2.2 \u5c42\u5c5e\u6027 vs \u8def\u5f84\u5c5e\u6027<\/h4>\n<p>\u8fd9\u91cc\u51fa\u73b0\u4e86\u4e00\u4e2a\u65b0\u7684\u5173\u952e\u533a\u5206\u2014\u2014\u4e24\u79cd\u6807\u8bb0\u7684\u751f\u547d\u5468\u671f&#xff1a;<\/p>\n<table>\n<tr>used \u6570\u7ec4&#xff08;47\/90&#xff09;usedThisLevel \u96c6\u5408&#xff08;491&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u8bb0\u5f55\u4ec0\u4e48<\/td>\n<td>\u4e0b\u6807\u662f\u5426\u5728 path \u91cc<\/td>\n<td>\u8fd9\u4e2a\u503c\u672c\u5c42\u662f\u5426\u8bd5\u8fc7<\/td>\n<\/tr>\n<tr>\n<td>\u751f\u547d\u5468\u671f<\/td>\n<td>\u8def\u5f84\u5c5e\u6027&#xff1a;\u505a\u9009\u62e9\u7f6e true\u3001\u8fd8\u539f\u7f6e false&#xff0c;\u968f\u4e00\u6761\u8def\u5f84\u7ffb\u8f6c<\/td>\n<td>\u5c42\u5c5e\u6027&#xff1a;\u6bcf\u6b21\u8fdb\u5165\u51fd\u6570\u65b0\u5efa&#xff0c;\u9012\u5f52\u8fd4\u56de\u540e\u4e0d\u8fd8\u539f<\/td>\n<\/tr>\n<tr>\n<td>\u4e3a\u4ec0\u4e48<\/td>\n<td>\u5b83\u63cf\u8ff0&#034;\u5f53\u524d\u8def\u5f84\u7684\u72b6\u6001&#034;&#xff0c;\u8def\u5f84\u53d8\u4e86\u5b83\u5c31\u53d8<\/td>\n<td>\u5b83\u63cf\u8ff0&#034;\u8fd9\u4e00\u5c42 for \u5faa\u73af\u5df2\u7ecf\u8bd5\u8fc7\u54ea\u4e9b\u503c&#034;&#xff0c;\u5faa\u73af\u8fd8\u5728\u672c\u5c42\u7ee7\u7eed&#xff0c;\u6807\u8bb0\u5fc5\u987b\u4fdd\u6301&#xff1b;\u4e0b\u4e00\u5c42\u9012\u5f52\u81ea\u5df1\u5efa\u65b0\u7684<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>usedThisLevel \u4e0d\u8fd8\u539f\u662f\u7cbe\u9ad3\u2014\u2014\u9012\u5f52\u8fd4\u56de\u540e\u672c\u5c42 for \u8fd8\u8981\u7ee7\u7eed\u8bd5 i&#043;1\u3001i&#043;2&#xff0c;&#034;\u8fd9\u4e2a\u503c\u8bd5\u8fc7\u4e86&#034;\u7684\u8bb0\u5f55\u5fc5\u987b\u7559\u4f4f\u3002\u5b83\u968f\u5c42\u751f\u706d&#xff0c;\u4e0d\u9700\u8981\u4f60\u8fd8\u539f\u3002<\/p>\n<h4>2.3 \u53bb\u91cd\u56db\u4ef6\u5957\u96c6\u9f50<\/h4>\n<p><span class=\"token keyword\">func<\/span> <span class=\"token function\">findSubsequences<\/span><span class=\"token punctuation\">(<\/span>nums <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span> <span class=\"token punctuation\">{<\/span><br \/>\nres <span class=\"token operator\">:&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><br \/>\npath <span class=\"token operator\">:&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">var<\/span> backtrack <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>start <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span><br \/>\nbacktrack <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>start <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token comment\">\/\/ \u6bcf\u8282\u70b9\u6536\u96c6&#xff1a;\u957f\u5ea6 \u2265 2 \u7684\u8282\u70b9\u5c31\u662f\u7b54\u6848\u2014\u2014\u6536\u96c6\u540e\u7ee7\u7eed&#xff0c;\u4e0d return<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">2<\/span> <span class=\"token punctuation\">{<\/span><br \/>\nres <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">append<\/span><span class=\"token punctuation\">(<\/span>res<span class=\"token punctuation\">,<\/span> slices<span class=\"token punctuation\">.<\/span><span class=\"token function\">Clone<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\nusedThisLevel <span class=\"token operator\">:&#061;<\/span> <span class=\"token keyword\">map<\/span><span class=\"token punctuation\">[<\/span><span class=\"token builtin\">int<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">bool<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span> <span class=\"token comment\">\/\/ \u5c42\u5c5e\u6027&#xff1a;\u672c\u5c42\u5df2\u8bd5\u8fc7\u7684&#034;\u503c&#034;<\/span><br \/>\n<span class=\"token keyword\">for<\/span> i <span class=\"token operator\">:&#061;<\/span> start<span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> <span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>nums<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token comment\">\/\/ \u5408\u6cd5\u6027&#xff1a;\u975e\u4e25\u683c\u9012\u589e\u3002continue \u4e0d\u662f break\u2014\u2014\u6ca1\u6392\u5e8f&#xff01;<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">&amp;&amp;<\/span> nums<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&lt;<\/span> path<span class=\"token punctuation\">[<\/span><span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">continue<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token comment\">\/\/ \u540c\u5c42\u53bb\u91cd&#xff1a;\u8fd9\u4e2a\u503c\u672c\u5c42\u5df2\u7ecf\u8bd5\u8fc7<\/span><br \/>\n<span class=\"token keyword\">if<\/span> usedThisLevel<span class=\"token punctuation\">[<\/span>nums<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">continue<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\nusedThisLevel<span class=\"token punctuation\">[<\/span>nums<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span> <span class=\"token comment\">\/\/ \u6807\u8bb0&#xff0c;\u4e0d\u8fd8\u539f&#xff08;\u5c42\u5c5e\u6027&#xff09;<\/span><br \/>\npath <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">append<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">,<\/span> nums<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token function\">backtrack<\/span><span class=\"token punctuation\">(<\/span>i <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><br \/>\npath <span class=\"token operator\">&#061;<\/span> path<span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">:<\/span><span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>path<span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token function\">backtrack<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">return<\/span> res<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<table>\n<tr>47 \u6392\u521740 \u7ec4\u540890 \u5b50\u96c6491 \u5b50\u5e8f\u5217<\/tr>\n<tbody>\n<tr>\n<td>\u9aa8\u67b6<\/td>\n<td>\u5168\u8303\u56f4 for &#043; used<\/td>\n<td>start \u63a8\u8fdb<\/td>\n<td>\u8981\/\u4e0d\u8981<\/td>\n<td>start \u63a8\u8fdb &#043; \u6bcf\u8282\u70b9\u6536\u96c6<\/td>\n<\/tr>\n<tr>\n<td>\u80fd\u6392\u5e8f\u5417<\/td>\n<td>\u80fd<\/td>\n<td>\u80fd<\/td>\n<td>\u80fd<\/td>\n<td>\u7981\u6b62<\/td>\n<\/tr>\n<tr>\n<td>\u53d1\u73b0\u540c\u5c42\u540c\u503c<\/td>\n<td>\u76f8\u90bb\u6bd4\u8f83<\/td>\n<td>\u76f8\u90bb\u6bd4\u8f83<\/td>\n<td>\u76f8\u90bb\u6bd4\u8f83<\/td>\n<td>\u5c42\u5185\u54c8\u5e0c\u96c6\u5408<\/td>\n<\/tr>\n<tr>\n<td>\u540c\u5c42\/\u540c\u679d\u533a\u5206<\/td>\n<td>!used[i-1]&#xff08;\u524d\u4e00\u4e2a\u5df2\u5f39\u51fa&#xff09;<\/td>\n<td>i &gt; start&#xff08;\u524d\u4e00\u4e2a\u662f\u672c\u5c42\u5019\u9009&#xff09;<\/td>\n<td>!used[i-1]<\/td>\n<td>\u96c6\u5408\u5c42\u4f5c\u7528\u57df\u5929\u7136\u533a\u5206<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e00\u4e2a\u539f\u5219&#xff08;\u540c\u5c42\u540c\u503c\u53ea\u8d70\u7b2c\u4e00\u4e2a&#xff09;\u3001\u4e24\u4e2a\u53d1\u73b0\u624b\u6bb5&#xff08;\u6392\u5e8f\u76f8\u90bb\/\u5c42\u5185\u96c6\u5408&#xff09;\u3001\u4e09\u79cd\u5c42\u754c\u5b9a\u65b9\u5f0f&#xff08;used \u7ffb\u8f6c\/start \u8fb9\u754c\/\u96c6\u5408\u4f5c\u7528\u57df&#xff09;\u2014\u2014\u56db\u9053\u9898\u4eb2\u624b\u7ffb\u8fc7\u8f66\u4fee\u5e72\u51c0&#xff0c;\u8fd9\u4e2a\u8003\u70b9\u624d\u7b97\u771f\u6b63\u710a\u6b7b\u3002<\/p>\n<h3>3. \u7ffb\u8f66\u516b&#xff1a;\u4e2d\u95f4\u6001\u5931\u63a7&#xff08;LC79 \u5355\u8bcd\u641c\u7d22&#xff09;<\/h3>\n<p>\u8fd9\u6b21\u7ffb\u8f66\u6700\u58ee\u89c2\u2014\u2014\u4e0d\u662f\u8d85\u65f6&#xff0c;\u662f\u628a Go \u7684\u6808\u6491\u7206\u4e86 1GB\u3002<\/p>\n<p>\u5355\u8bcd\u641c\u7d22&#xff1a;\u7f51\u683c\u91cc\u6309\u4e0a\u4e0b\u5de6\u53f3\u627e\u5355\u8bcd&#xff0c;\u683c\u5b50\u4e0d\u80fd\u590d\u7528\u3002\u6211\u7b2c\u4e00\u7248\u8bbe\u8ba1\u4e86\u4e00\u4e2a step \u53c2\u6570\u6765\u533a\u5206&#034;\u79fb\u52a8\u4e86\u4e00\u6b65&#034;\u548c&#034;\u5339\u914d\u4e86\u4e00\u4e2a\u5b57\u7b26&#034;&#xff0c;\u8ba9\u9012\u5f52\u540c\u65f6\u627f\u62c5&#034;\u5728\u7f51\u683c\u4e0a\u79fb\u52a8&#034;\u548c&#034;\u5339\u914d\u5b57\u7b26&#034;\u4e24\u4e2a\u804c\u8d23\u3002\u8dd1 ABCB \u7528\u4f8b&#xff0c;\u76f4\u63a5&#xff1a;<\/p>\n<p>fatal error: stack overflow&#xff08;goroutine \u6808\u8d85\u8fc7 1GB \u4e0a\u9650&#xff09;<\/p>\n<p>main.existUser.func1(0x2, 0x4, {\u7a7apath}, 0x0, step&#061;2233116)  \u2190 step \u6da8\u5230 223 \u4e07<br \/>\nmain.existUser.func1(0x2, 0x3, {\u7a7apath}, 0x0, step&#061;2233115)<br \/>\nmain.existUser.func1(0x1, 0x3, {\u7a7apath}, 0x0, step&#061;2233114)  \u2190 \u5728 (1,3)\u2194(2,3) \u4e4b\u95f4<br \/>\nmain.existUser.func1(0x2, 0x3, &#8230;)                          \u2190 \u6765\u56de\u9707\u8361&#xff0c;\u6ca1\u6709\u4e1c\u897f\u62e6\u5b83<\/p>\n<h4>3.1 \u75c5\u6839&#xff1a;\u79fb\u52a8\u548c\u5339\u914d\u88ab\u62c6\u6210\u4e86\u4e24\u4e2a\u9012\u5f52<\/h4>\n<p>\u6211\u7684 step \u673a\u5236\u4ea7\u751f\u4e86&#034;\u79fb\u52a8\u4e86\u4f46\u8fd8\u6ca1\u5339\u914d&#034;\u7684\u4e2d\u95f4\u6001\u2014\u2014\u7a7a path \u65f6\u8fd9\u4e2a\u72b6\u6001\u6ca1\u6709\u4efb\u4f55\u7ec8\u6b62\u6761\u4ef6&#xff08;\u6ca1\u6709 visited \u62e6\u622a\u3001\u6ca1\u6709\u6b65\u6570\u4e0a\u9650&#xff09;&#xff0c;\u6f2b\u6e38\u5728\u7f51\u683c\u73af\u4e0a\u65e0\u9650\u8f6c&#xff0c;\u76f4\u5230\u6808\u7206\u3002<\/p>\n<h4>3.2 \u4fee\u590d&#xff1a;\u79fb\u52a8\u5373\u5339\u914d&#xff0c;\u6d88\u706d\u4e2d\u95f4\u6001<\/h4>\n<p><span class=\"token comment\">\/\/ \u8bed\u4e49&#xff1a;word[idx] \u5fc5\u987b\u5728 (r,c) \u8fd9\u4e2a\u683c\u5b50\u4e0a\u5339\u914d<\/span><br \/>\n<span class=\"token keyword\">var<\/span> dfs <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token punctuation\">,<\/span> c<span class=\"token punctuation\">,<\/span> idx <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token builtin\">bool<\/span><br \/>\ndfs <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token punctuation\">,<\/span> c<span class=\"token punctuation\">,<\/span> idx <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token builtin\">bool<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> r <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">||<\/span> r <span class=\"token operator\">&gt;&#061;<\/span> m <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">0<\/span> <span class=\"token operator\">||<\/span> c <span class=\"token operator\">&gt;&#061;<\/span> n <span class=\"token punctuation\">{<\/span>        <span class=\"token comment\">\/\/ \u51fa\u754c<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> used<span class=\"token punctuation\">[<\/span>r<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>c<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">||<\/span> board<span class=\"token punctuation\">[<\/span>r<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>c<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">!&#061;<\/span> word<span class=\"token punctuation\">[<\/span>idx<span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span>     <span class=\"token comment\">\/\/ \u5df2\u7528 \/ \u5b57\u6bcd\u4e0d\u5339\u914d<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> idx <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token function\">len<\/span><span class=\"token punctuation\">(<\/span>word<span class=\"token punctuation\">)<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span> <span class=\"token punctuation\">{<\/span>                          <span class=\"token comment\">\/\/ \u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u5339\u914d\u4e0a\u4e86<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">true<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    used<span class=\"token punctuation\">[<\/span>r<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>c<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span>                                <span class=\"token comment\">\/\/ \u505a\u9009\u62e9<\/span><br \/>\n    found <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">dfs<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token punctuation\">,<\/span> idx<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">||<\/span> <span class=\"token function\">dfs<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> c<span class=\"token punctuation\">,<\/span> idx<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">||<\/span><br \/>\n        <span class=\"token function\">dfs<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token punctuation\">,<\/span> c<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> idx<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">||<\/span> <span class=\"token function\">dfs<\/span><span class=\"token punctuation\">(<\/span>r<span class=\"token punctuation\">,<\/span> c<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> idx<span class=\"token operator\">&#043;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>     <span class=\"token comment\">\/\/ \u56db\u65b9\u5411 &#061; \u5339\u914d\u4e0b\u4e00\u5b57\u7b26<\/span><br \/>\n    used<span class=\"token punctuation\">[<\/span>r<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>c<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">false<\/span>                               <span class=\"token comment\">\/\/ \u8fd8\u539f<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> found<br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token comment\">\/\/ \u8d77\u70b9\u68ee\u6797\u5728\u5916\u5c42&#xff1a;\u53cc\u91cd\u5faa\u73af\u679a\u4e3e\u6240\u6709\u683c\u5b50\u4f5c\u4e3a\u8d77\u70b9<\/span><\/p>\n<p>\u4e09\u53c2\u6570 (r, c, idx) \u7684\u6bcf\u4e2a\u72b6\u6001\u90fd\u662f\u5408\u6cd5\u5c40\u9762\u3002\u5411\u90bb\u5c45\u79fb\u52a8\u4e00\u6b65\u5c31\u662f\u53bb\u5339\u914d\u4e0b\u4e00\u4e2a\u5b57\u7b26\u2014\u2014\u79fb\u52a8\u548c\u5339\u914d\u662f\u539f\u5b50\u7684&#xff0c;\u4e0d\u53ef\u5206\u3002\u9012\u5f52\u91cc\u6839\u672c\u4e0d\u5b58\u5728&#034;\u79fb\u52a8\u4e86\u4f46\u6ca1\u5339\u914d&#034;\u8fd9\u79cd\u72b6\u6001\u3002<\/p>\n<h4>3.3 \u7c92\u5ea6\u7684\u4e24\u4e2a\u65b9\u5411<\/h4>\n<p>\u6709\u610f\u601d\u7684\u662f&#xff0c;\u8fd9\u6b21\u9519\u8bef\u548c\u7b2c\u4e00\u6b21\u7ffb\u8f66&#xff08;\u62ec\u53f7\u9898&#xff09;\u65b9\u5411\u6b63\u597d\u76f8\u53cd&#xff1a;<\/p>\n<p>LC22 \u62ec\u53f7&#xff1a;\u628a\u591a\u4e2a\u539f\u5b50\u52a8\u4f5c\u6253\u5305\u6210\u4e00\u4e2a\u51b3\u7b56&#xff08;&#034;\u653e idx \u5bf9&#034;&#xff09;\u2192 \u7c92\u5ea6\u8fc7\u7c97 \u2192 \u7f3a\u89e3<br \/>\nLC79 \u7f51\u683c&#xff1a;\u628a\u4e00\u4e2a\u539f\u5b50\u52a8\u4f5c\u5288\u6210\u4e24\u4e2a\u9012\u5f52&#xff08;\u79fb\u52a8&#043;\u5339\u914d&#xff09;    \u2192 \u7c92\u5ea6\u8fc7\u788e \u2192 \u4e2d\u95f4\u6001\u5931\u63a7<\/p>\n<p>\u65b9\u5411\u76f8\u53cd&#xff0c;\u75c5\u6839\u76f8\u540c&#xff1a;\u6ca1\u8bc6\u522b\u51fa\u771f\u6b63\u7684\u539f\u5b50\u52a8\u4f5c\u3002&#034;\u6700\u5c0f\u51b3\u7b56&#034;\u7684\u6700\u5c0f\u4e0d\u662f\u8d8a\u5c0f\u8d8a\u597d&#xff0c;\u800c\u662f\u6070\u597d\u7b49\u4e8e\u4e00\u4e2a\u4e0d\u53ef\u5206\u5272\u7684\u5b8c\u6574\u8bed\u4e49\u5355\u5143\u3002\u4ee3\u7801\u53ef\u5206&#xff08;\u6539\u5750\u6807\u548c\u6bd4\u5b57\u7b26\u662f\u4e24\u884c&#xff09;\u2260 \u8bed\u4e49\u53ef\u5206&#xff08;\u201c\u8d70\u4e00\u6b65&#034;\u7684\u610f\u601d\u5c31\u662f&#034;\u53bb\u90a3\u91cc\u5339\u914d\u4e0b\u4e00\u4e2a\u5b57\u201d&#xff09;\u3002<\/p>\n<h4>3.4 \u51b3\u7b56\u8bbe\u8ba1\u56db\u68c0\u9a8c&#xff08;\u4e09\u9a8c\u8bc1\u5347\u7ea7\u7248&#xff09;<\/h4>\n<p>1. \u539f\u5b50\u6027&#xff1a;\u8fd9\u4e2a\u51b3\u7b56\u80fd\u62c6\u6210\u4e24\u4e2a\u6709\u72ec\u7acb\u8bed\u4e49\u7684\u52a8\u4f5c\u5417&#xff1f;<br \/>\n   \u80fd \u2192 \u5207\u7684\u4f4d\u7f6e\u53ef\u80fd\u9519\u4e86&#xff08;LC79 \u7684\u6559\u8bad&#xff09;<br \/>\n2. \u4e2d\u95f4\u6001\u5408\u6cd5\u6027&#xff1a;\u62c6\u5f00\u540e\u51fa\u73b0\u7684\u4e2d\u95f4\u72b6\u6001&#xff0c;\u9898\u76ee\u8bed\u4e49\u91cc\u5b58\u5728\u5417&#xff1f;<br \/>\n   \u4e0d\u5b58\u5728 \u2192 \u5fc5\u987b\u5408\u5e76&#xff08;LC79&#xff1a;\u79fb\u52a8&#043;\u5339\u914d&#xff09;<br \/>\n3. \u8986\u76d6\u5b8c\u6574\u6027&#xff1a;\u6240\u6709\u5408\u6cd5\u89e3\u90fd\u80fd\u88ab\u67d0\u4e2a\u51b3\u7b56\u5e8f\u5217\u6784\u9020\u51fa\u6765\u5417&#xff1f;<br \/>\n   \u4e0d\u80fd \u2192 \u7c92\u5ea6\u8fc7\u7c97&#xff08;LC22&#xff1a;(()()) \u65e0\u8def\u5f84&#xff09;<br \/>\n4. \u7ea6\u675f\u5c40\u90e8\u53ef\u5224&#xff1a;\u6bcf\u4e2a\u51b3\u7b56\u70b9\u7684\u53ef\u884c\u6027&#xff0c;\u80fd\u7528\u5f53\u524d\u72b6\u6001 O(1) \u5224\u65ad\u5417&#xff1f;<\/p>\n<h3>4. \u72b6\u6001\u8bbe\u8ba1\u6536\u5b98&#xff1a;N \u7687\u540e&#xff08;LC51&#xff09;<\/h3>\n<p>\u6700\u540e\u4e00\u9898&#xff0c;N \u7687\u540e\u3002\u7b2c\u4e00\u7248\u76f4\u63a5\u5d29\u4e86&#xff1a;\u6ca1\u6709\u9012\u5f52\u4e0b\u6c89\u3001\u5bf9\u89d2\u7ebf\u68c0\u67e5\u53ea\u6392\u4e86\u7a7f\u8fc7\u68cb\u76d8\u4e2d\u5fc3\u7684\u4e24\u6761&#xff08;i&#061;&#061;row\u3001row&#043;i&#061;&#061;n-1&#xff09;\u3001\u8fb9\u653e\u7687\u540e\u8fb9\u653e\u955c\u50cf\u4f4d&#xff08;\u5e7b\u89c9&#xff09;\u3001\u5916\u5c42\u5faa\u73af\u628a\u8d77\u70b9\u6982\u5ff5\u641e\u6df7\u3002\u4ece\u5934\u91cd\u5efa\u3002<\/p>\n<h4>4.1 \u9aa8\u67b6&#xff1a;\u6bcf\u5c42\u4e00\u884c&#xff0c;\u4e00\u6b21\u8c03\u7528<\/h4>\n<p>N \u7687\u540e\u4e0d\u9700\u8981\u8d77\u70b9\u68ee\u6797&#xff08;\u5355\u8bcd\u641c\u7d22\u9700\u8981&#xff0c;\u8fd9\u9898\u4e0d\u9700\u8981&#xff09;&#xff1a;\u5355\u8bcd\u641c\u7d22\u7684\u8def\u5f84\u53ef\u4ee5\u4ece\u4efb\u4f55\u683c\u5b50\u5f00\u59cb&#xff1b;N \u7687\u540e\u6bcf\u884c\u5fc5\u987b\u6070\u597d\u653e\u4e00\u4e2a&#xff0c;\u5904\u7406\u987a\u5e8f\u5929\u7136\u662f\u7b2c 0 \u884c\u5230\u7b2c n-1 \u884c\u2014\u2014\u4e00\u6b21\u8c03\u7528 solve(0)&#xff0c;\u7b2c\u4e00\u884c\u7684\u7687\u540e\u653e\u54ea\u5217\u7531\u7b2c\u4e00\u5c42\u7684 for \u51b3\u5b9a\u3002<\/p>\n<h4>4.2 \u5bf9\u89d2\u7ebf\u7684\u6570\u5b66&#xff1a;\u8fd9\u9898\u7684\u7075\u9b42<\/h4>\n<p>\u7687\u540e\u653b\u51fb\u7ebf\u6709\u4e09\u79cd&#xff08;\u884c\u4e0d\u7528\u67e5\u2014\u2014\u6bcf\u5c42\u53ea\u653e\u4e00\u884c&#xff0c;\u5929\u7136\u4e0d\u51b2\u7a81&#xff09;\u3002\u5217\u5f88\u76f4\u89c2&#xff0c;\u4e24\u6761\u5bf9\u89d2\u7ebf\u662f\u7075\u9b42\u3002\u5728\u5bf9\u89d2\u7ebf\u4e0a\u8d70\u4e00\u6b65&#xff0c;\u5750\u6807\u53d8\u5316\u662f\u56fa\u5b9a\u7684&#xff1a;<\/p>\n<p>\u2197 \u65b9\u5411\u8d70\u4e00\u6b65&#xff1a;r&#043;1, c-1 \u2192 r&#043;c \u4e0d\u53d8     \u2192 \u540c\u4e00\u6761 \u2197 \u5bf9\u89d2\u7ebf\u4e0a&#xff0c;r&#043;c \u6052\u5b9a<br \/>\n\u2198 \u65b9\u5411\u8d70\u4e00\u6b65&#xff1a;r&#043;1, c&#043;1 \u2192 r-c \u4e0d\u53d8     \u2192 \u540c\u4e00\u6761 \u2198 \u5bf9\u89d2\u7ebf\u4e0a&#xff0c;r-c \u6052\u5b9a<\/p>\n<p>\u62ff 4\u00d74 \u68cb\u76d8\u628a r&#043;c \u7b97\u51fa\u6765&#xff0c;\u76f8\u540c\u6570\u5b57\u5c31\u662f\u540c\u4e00\u6761\u5bf9\u89d2\u7ebf&#xff1a;<\/p>\n<p>r&#043;c:      r-c:<br \/>\n0 1 2 3      0 -1 -2 -3<br \/>\n1 2 3 4      1  0 -1 -2<br \/>\n2 3 4 5      2  1  0 -1<br \/>\n3 4 5 6      3  2  1  0<\/p>\n<table>\n<tr>\u51b2\u7a81\u7ebf\u6807\u8bb0\u6570\u7ec4\u7d22\u5f15\u5927\u5c0f<\/tr>\n<tbody>\n<tr>\n<td>\u5217<\/td>\n<td>cols[col]<\/td>\n<td>col \u2208 [0, n-1]<\/td>\n<td>n<\/td>\n<\/tr>\n<tr>\n<td>\u2197 \u5bf9\u89d2\u7ebf<\/td>\n<td>diag1[r&#043;c]<\/td>\n<td>r&#043;c \u2208 [0, 2n-2]<\/td>\n<td>2n-1<\/td>\n<\/tr>\n<tr>\n<td>\u2198 \u5bf9\u89d2\u7ebf<\/td>\n<td>diag2[r-c&#043;n-1]<\/td>\n<td>r-c \u2208 [-(n-1), n-1]&#xff0c;\u52a0 n-1 \u504f\u79fb\u6d88\u706d\u8d1f\u6570<\/td>\n<td>2n-1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5168\u68cb\u76d8\u5171 4n-2 \u6761\u5bf9\u89d2\u7ebf&#xff0c;r\u00b1c \u7ed9\u6bcf\u4e00\u6761\u552f\u4e00\u7f16\u53f7\u2014\u2014\u8fd9\u5c31\u662f&#034;\u6838\u5fc3\u662f\u5bf9\u659c\u7ebf\u8fdb\u884c\u7f16\u53f7&#034;\u3002<\/p>\n<h4>4.3 \u4e09\u4e2a\u6807\u8bb0\u6570\u7ec4 &#043; \u56db\u52a8\u4f5c\u5bf9<\/h4>\n<p><span class=\"token keyword\">func<\/span> <span class=\"token function\">solveNQueens<\/span><span class=\"token punctuation\">(<\/span>n <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">string<\/span> <span class=\"token punctuation\">{<\/span><br \/>\nres <span class=\"token operator\">:&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">string<\/span><span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span><br \/>\npan <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">byte<\/span><span class=\"token punctuation\">,<\/span> n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">for<\/span> i <span class=\"token operator\">:&#061;<\/span> <span class=\"token keyword\">range<\/span> pan <span class=\"token punctuation\">{<\/span><br \/>\npan<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">byte<\/span><span class=\"token punctuation\">,<\/span> n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">for<\/span> j <span class=\"token operator\">:&#061;<\/span> <span class=\"token keyword\">range<\/span> pan<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span><br \/>\npan<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>j<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token char\">&#039;.&#039;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\ncols <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">bool<\/span><span class=\"token punctuation\">,<\/span> n<span class=\"token punctuation\">)<\/span>      <span class=\"token comment\">\/\/ \u5217\u5360\u7528<\/span><br \/>\ndiag1 <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">bool<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token operator\">*<\/span>n<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\">\/\/ \u2197 \u5bf9\u89d2\u7ebf\u5360\u7528&#xff1a;\u7f16\u53f7 r&#043;c<\/span><br \/>\ndiag2 <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">bool<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token operator\">*<\/span>n<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\">\/\/ \u2198 \u5bf9\u89d2\u7ebf\u5360\u7528&#xff1a;\u7f16\u53f7 r-c&#043;n-1<\/span><\/p>\n<p><span class=\"token keyword\">var<\/span> solve <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>row <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span><br \/>\nsolve <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">func<\/span><span class=\"token punctuation\">(<\/span>row <span class=\"token builtin\">int<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">if<\/span> row <span class=\"token operator\">&#061;&#061;<\/span> n <span class=\"token punctuation\">{<\/span>                       <span class=\"token comment\">\/\/ \u5224\u7ec8&#xff1a;\u6536\u96c6\u68cb\u76d8<\/span><br \/>\nsol <span class=\"token operator\">:&#061;<\/span> <span class=\"token function\">make<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> n<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">for<\/span> i <span class=\"token operator\">:&#061;<\/span> <span class=\"token keyword\">range<\/span> pan <span class=\"token punctuation\">{<\/span><br \/>\nsol<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">string<\/span><span class=\"token punctuation\">(<\/span>pan<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\nres <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">append<\/span><span class=\"token punctuation\">(<\/span>res<span class=\"token punctuation\">,<\/span> sol<span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">return<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">for<\/span> col <span class=\"token operator\">:&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> col <span class=\"token operator\">&lt;<\/span> n<span class=\"token punctuation\">;<\/span> col<span class=\"token operator\">&#043;&#043;<\/span> <span class=\"token punctuation\">{<\/span>      <span class=\"token comment\">\/\/ \u51b3\u7b56&#xff1a;\u8fd9\u884c\u653e\u54ea\u5217<\/span><br \/>\n<span class=\"token keyword\">if<\/span> cols<span class=\"token punctuation\">[<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">||<\/span> diag1<span class=\"token punctuation\">[<\/span>row<span class=\"token operator\">&#043;<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">||<\/span> diag2<span class=\"token punctuation\">[<\/span>row<span class=\"token operator\">&#8211;<\/span>col<span class=\"token operator\">&#043;<\/span>n<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n<span class=\"token keyword\">continue<\/span>                     <span class=\"token comment\">\/\/ \u4efb\u4f55\u4e00\u6761\u7ebf\u88ab\u5360&#xff0c;\u6362\u5217<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\ncols<span class=\"token punctuation\">[<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span>                <span class=\"token comment\">\/\/ \u505a\u9009\u62e9&#xff1a;\u4e09\u4e2a\u6807\u8bb0 &#043; \u68cb\u76d8<\/span><br \/>\ndiag1<span class=\"token punctuation\">[<\/span>row<span class=\"token operator\">&#043;<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span><br \/>\ndiag2<span class=\"token punctuation\">[<\/span>row<span class=\"token operator\">&#8211;<\/span>col<span class=\"token operator\">&#043;<\/span>n<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span><br \/>\npan<span class=\"token punctuation\">[<\/span>row<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token char\">&#039;Q&#039;<\/span><br \/>\n<span class=\"token function\">solve<\/span><span class=\"token punctuation\">(<\/span>row <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>                  <span class=\"token comment\">\/\/ \u4e0b\u6c89&#xff1a;\u4e0b\u4e00\u884c<\/span><br \/>\ncols<span class=\"token punctuation\">[<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">false<\/span>               <span class=\"token comment\">\/\/ \u8fd8\u539f&#xff1a;\u56db\u4e2a\u52a8\u4f5c\u9010\u4e00\u64a4\u9500<\/span><br \/>\ndiag1<span class=\"token punctuation\">[<\/span>row<span class=\"token operator\">&#043;<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">false<\/span><br \/>\ndiag2<span class=\"token punctuation\">[<\/span>row<span class=\"token operator\">&#8211;<\/span>col<span class=\"token operator\">&#043;<\/span>n<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">false<\/span><br \/>\npan<span class=\"token punctuation\">[<\/span>row<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span>col<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token char\">&#039;.&#039;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token function\">solve<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">return<\/span> res<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u91cd\u5199\u7248\u7528\u89e3\u6570\u5e8f\u5217\u9a8c\u8bc1\u5230 n&#061;8&#xff1a;1 0 0 2 10 4 40 92&#xff0c;\u5168\u5bf9\u3002\u6ce8\u610f&#034;\u505a\u9009\u62e9&#034;\u548c&#034;\u8fd8\u539f&#034;\u662f\u56db\u4e2a\u52a8\u4f5c\u5bf9&#xff08;\u4e09\u6807\u8bb0 &#043; \u68cb\u76d8\u5b57\u7b26&#xff09;\u2014\u2014\u505a\u591a\u5c11&#xff0c;\u64a4\u9500\u591a\u5c11&#xff0c;\u7eaa\u5f8b\u548c\u53cc\u52a8\u4f5c\u65f6\u4ee3\u4e00\u6837\u3002<\/p>\n<h4>4.4 &#034;\u6298\u53e0\u5224\u65ad&#034;\u7684\u7b2c\u56db\u6b21\u767b\u573a<\/h4>\n<p>\u56de\u5934\u770b\u4e00\u6761\u6697\u7ebf&#xff1a;\u628a O(n) \u7684\u68c0\u67e5\u6298\u53e0\u6210 O(1) \u67e5\u8868&#xff0c;\u8fd9\u4e2a\u62db\u5f0f\u51fa\u73b0\u4e86\u56db\u6b21\u2014\u2014131 \u7684\u56de\u6587\u8868&#xff08;\u56de\u6587\u5224\u65ad O(n) \u2192 \u67e5\u8868&#xff09;\u3001140 \u7684 can \u6570\u7ec4&#xff08;\u53ef\u884c\u6027\u6298\u53e0&#xff09;\u3001464 \u7684\u4f4d\u63a9\u7801&#xff08;\u96c6\u5408\u5224\u65ad\u6298\u53e0&#xff09;\u300151 \u7684\u5bf9\u89d2\u7ebf\u6807\u8bb0\u6570\u7ec4&#xff08;\u51b2\u7a81\u68c0\u67e5 O(n) \u2192 \u67e5\u8868&#xff09;\u3002\u6bcf\u6b21\u8f7d\u4f53\u4e0d\u540c&#xff0c;\u539f\u7406\u540c\u4e00&#xff1a;\u7ea6\u675f\u7684\u5224\u65ad\u4e0e\u8def\u5f84\u65e0\u5173&#xff0c;\u5c31\u53ef\u4ee5\u9884\u8ba1\u7b97\/\u589e\u91cf\u7ef4\u62a4&#xff0c;\u53d8\u6210\u67e5\u8868\u3002<\/p>\n<h3>5. \u8bc6\u522b\u6846\u67b6&#xff1a;\u4e09\u5c42\u6f0f\u6597<\/h3>\n<p>\u5341\u4e00\u7c7b\u9898\u7ffb\u4e0b\u6765&#xff0c;\u6700\u540e\u628a&#034;\u62ff\u5230\u9898\u600e\u4e48\u5feb\u901f\u5224\u65ad&#034;\u6c89\u6dc0\u6210\u4e09\u5c42\u6f0f\u6597&#xff0c;\u6bcf\u5c42 10 \u79d2&#xff1a;<\/p>\n<h4>5.1 \u7b2c\u4e00\u5c42&#xff1a;\u8303\u5f0f\u95f8\u95e8&#xff08;\u662f\u4e0d\u662f\u56de\u6eaf&#xff09;<\/h4>\n<table>\n<tr>\u9898\u9762\u95ee\u6cd5\u8303\u5f0f<\/tr>\n<tbody>\n<tr>\n<td>\u201c\u8fd4\u56de\u6240\u6709\u65b9\u6848 \/ \u5217\u4e3e\u5168\u90e8\u201d<\/td>\n<td>\u56de\u6eaf<\/td>\n<\/tr>\n<tr>\n<td>\u201c\u80fd\u5426\u2026 \/ \u5b58\u5728\u4e00\u79cd\u2026\u201d<\/td>\n<td>\u56de\u6eaf&#xff08;\u77ed\u8def\u7248&#xff09;\u6216 DP<\/td>\n<\/tr>\n<tr>\n<td>\u201c\u6700\u5c11\/\u6700\u5927\/\u6700\u591a\u201d<\/td>\n<td>DP \u6216\u8d2a\u5fc3<\/td>\n<\/tr>\n<tr>\n<td>\u201c\u591a\u5c11\u79cd\u65b9\u6cd5\u201d<\/td>\n<td>DP<\/td>\n<\/tr>\n<tr>\n<td>n \u2264 20<\/td>\n<td>\u679a\u4e3e\u53ef\u63a5\u53d7&#xff0c;\u56de\u6eaf\u5019\u9009<\/td>\n<\/tr>\n<tr>\n<td>n \u2265 10^4<\/td>\n<td>\u4e0e\u56de\u6eaf\u65e0\u7f18<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>5.2 \u7b2c\u4e8c\u5c42&#xff1a;\u5bb6\u65cf\u95f8\u95e8&#xff08;\u7528\u54ea\u4e2a\u9aa8\u67b6&#xff09;<\/h4>\n<ul>\n<li>\u201c\u987a\u5e8f\u6709\u610f\u4e49\u5417&#xff1f;\u201d \u6709 \u2192 \u6392\u5217&#xff08;used &#043; \u5168\u8303\u56f4\u5faa\u73af&#xff09;&#xff1b;\u65e0 \u2192 \u7ec4\u5408&#xff08;start \u63a8\u8fdb&#xff09;<\/li>\n<li>\u201c\u5207\u5b57\u7b26\u4e32\/\u5e8f\u5217\u5417&#xff1f;\u201d \u2192 \u5207\u5272&#xff08;\u5207\u591a\u957f&#xff09;<\/li>\n<li>\u201c\u6bcf\u4e2a\u5143\u7d20\u53ef\u4ee5\u4e0d\u9009\u5417&#xff1f;\u201d \u2192 \u8981\/\u4e0d\u8981&#xff08;\u5b50\u96c6&#xff09;<\/li>\n<\/ul>\n<h4>5.3 \u7b2c\u4e09\u5c42&#xff1a;\u5ef6\u4f38\u6a21\u5757\u626b\u63cf&#xff08;\u52a0\u4ec0\u4e48\u88c5\u5907&#xff09;<\/h4>\n<table>\n<tr>\u9898\u9762\u4fe1\u53f7\u6302\u8f7d\u6a21\u5757<\/tr>\n<tbody>\n<tr>\n<td>\u201c\u5019\u9009\u53ef\u80fd\u542b\u91cd\u590d\u201d \/ \u201c\u89e3\u4e0d\u80fd\u91cd\u590d\u201d<\/td>\n<td>\u540c\u5c42\u53bb\u91cd&#xff08;\u6392\u5e8f\u76f8\u90bb or \u5c42\u5185\u96c6\u5408&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u201c\u5224\u65ad\u80fd\u5426\u201d \/ \u201c\u8fd4\u56de\u4efb\u610f\u4e00\u4e2a\u201d<\/td>\n<td>\u5b58\u5728\u6027\u77ed\u8def<\/td>\n<\/tr>\n<tr>\n<td>\u201c\u6700\u5c11\u5207\u51e0\u5200\u201d \/ \u201c\u6700\u591a\u62c6\u51e0\u6bb5\u201d<\/td>\n<td>\u6392\u5e8f &#043; break \u526a\u679d&#xff1b;\u6700\u4f18\u503c\u4f18\u5148\u60f3 DP<\/td>\n<\/tr>\n<tr>\n<td>\u6bb5\u7684\u6027\u8d28\u88ab\u53cd\u590d\u5224\u65ad&#xff08;\u56de\u6587\/\u9012\u589e\/\u6c42\u548c&#xff09;<\/td>\n<td>\u9884\u5904\u7406\u8868&#xff08;O(n) \u5224\u65ad\u6298\u53e0\u6210 O(1) \u67e5\u8868&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u7ea6\u675f\u53ea\u770b\u8ba1\u6570\u4e0d\u770b\u6392\u5217<\/td>\n<td>\u8ba1\u6570\u5668\u72b6\u6001&#xff08;\u5982\u62ec\u53f7\u7684 open\/close&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u201c\u5212\u5206\u6210 k \u7ec4\u201d<\/td>\n<td>\u5206\u7ec4\u9aa8\u67b6&#xff08;\u5143\u7d20 \u2192 \u6876&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u72b6\u6001\u4e0e\u8def\u5f84\u5206\u79bb&#xff08;\u5207\u5206\/\u7f51\u683c\/\u535a\u5f08&#xff09;<\/td>\n<td>\u8bb0\u5fc6\u5316&#xff08;\u7f13\u5b58\u7ed3\u8bba&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4e2d\u6700\u540e\u4e00\u884c\u7684\u5224\u65ad\u6cd5&#xff1a;\u5148\u95ee&#034;\u6211\u7684\u72b6\u6001\u662f\u4ec0\u4e48&#034;&#xff0c;\u518d\u95ee&#034;\u4e0d\u540c\u8def\u5f84\u4f1a\u574d\u7f29\u5230\u540c\u4e00\u72b6\u6001\u5417&#034;\u2014\u2014\u4f1a&#xff0c;\u5c31\u5fc5\u987b\u60f3\u8bb0\u5fc6\u5316&#xff1b;\u6392\u5217\/\u7ec4\u5408\/\u5b50\u96c6\u7684\u8def\u5f84\u5373\u72b6\u6001&#xff0c;\u6c38\u8fdc\u4e0d\u7528\u60f3\u3002<\/p>\n<h4>5.4 \u5b9e\u64cd\u6d41\u7a0b&#xff1a;\u8fed\u4ee3\u5f0f<\/h4>\n<p>\u8bfb\u9898 \u2192 \u4e09\u5c42\u6f0f\u6597\u8fc7\u4e00\u904d&#xff08;30 \u79d2&#xff09;<br \/>\n     \u2192 \u5199\u6734\u7d20\u9aa8\u67b6&#xff08;\u5bb6\u65cf\u6a21\u677f &#043; \u547d\u4e2d\u7684\u5ef6\u4f38\u6a21\u5757&#xff09;<br \/>\n     \u2192 \u62ff\u6781\u7aef\u7528\u4f8b\u8bd5\u8dd1&#xff08;\u65e0\u89e3\u3001\u5168\u91cd\u590d\u3001\u6700\u5927\u89c4\u6a21&#xff09;<br \/>\n        \u251c\u2500 \u8d85\u65f6 \u2192 \u8865\u8bb0\u5fc6\u5316&#xff08;\u95ee\u81ea\u5df1&#xff1a;\u7f13\u5b58\u7684\u662f\u7ed3\u8bba\u8fd8\u662f\u9009\u62e9&#xff1f;&#xff09;<br \/>\n        \u251c\u2500 \u7ed3\u679c\u91cd\u590d \u2192 \u8865\u540c\u5c42\u53bb\u91cd&#xff08;\u80fd\u7528\u6392\u5e8f\u5417&#xff1f;&#xff09;<br \/>\n        \u2514\u2500 \u7f3a\u89e3 \u2192 \u51b3\u7b56\u7c92\u5ea6\u6216\u6a21\u578b\u9519\u4e86&#xff0c;\u56de\u7089\u56db\u68c0\u9a8c<br \/>\n     \u2192 \u5199\u7801\u524d\u626b\u7ec8\u6781\u68c0\u67e5\u6e05\u5355<\/p>\n<p>\u5224\u65ad\u5ef6\u4f38\u4e0d\u5fc5\u4e00\u6b21\u5168\u5bf9\u2014\u2014\u6781\u7aef\u7528\u4f8b\u4f1a\u66ff\u4f60\u66b4\u9732\u7f3a\u4ec0\u4e48\u3002<\/p>\n<h3>6. \u7ec8\u6781\u68c0\u67e5\u6e05\u5355<\/h3>\n<p>\u5199\u4efb\u4f55\u56de\u6eaf\u9898\u4e4b\u524d&#xff0c;\u6309\u8fd9\u5f20\u8868\u8fc7\u4e00\u904d&#xff1a;<\/p>\n<ul>\n<li class=\"task-list-item\"> \u8303\u5f0f&#xff1a;\u8981&#034;\u6240\u6709\u65b9\u6848&#034;\u624d\u7528\u56de\u6eaf&#xff1b;\u53ea\u8981&#034;\u80fd\u4e0d\u80fd\/\u591a\u5c11\u79cd&#034;\u53bb\u60f3 DP<\/li>\n<li class=\"task-list-item\"> \u51b3\u7b56&#xff1a;\u770b\u7740\u7b54\u6848\u957f\u51fa\u6765&#xff0c;\u6bcf\u5c42\u4e00\u4e2a\u539f\u5b50\u52a8\u4f5c&#xff1b;\u4f4d\u7f6e\u80fd\u7a7a \u2192 \u8981\/\u4e0d\u8981&#xff0c;\u4e0d\u80fd\u7a7a \u2192 \u9009\u4e00\u4e2a\/\u5207\u4e00\u6bb5<\/li>\n<li class=\"task-list-item\"> \u56db\u68c0\u9a8c&#xff1a;\u539f\u5b50\u6027&#xff08;\u79fb\u52a8&#043;\u5339\u914d\u4e0d\u53ef\u62c6&#xff09;&#xff1f;\u4e2d\u95f4\u6001\u5408\u6cd5&#xff08;\u62c6\u5f00\u7684\u72b6\u6001\u9898\u76ee\u91cc\u5b58\u5728\u5417&#xff09;&#xff1f;\u8986\u76d6\u5b8c\u6574&#xff1f;\u7ea6\u675f\u5c40\u90e8\u53ef\u5224&#xff1f;<\/li>\n<li class=\"task-list-item\"> \u5224\u7ec8&#xff1a;&#034;\u5230\u8fbe\u7ed3\u5c3e&#034;\u548c&#034;\u6ee1\u8db3\u8981\u6c42&#034;\u662f\u4e14\u4e0d\u662f\u6216<\/li>\n<li class=\"task-list-item\"> \u6536\u96c6&#xff1a;\u62f7\u8d1d\u5feb\u7167&#xff08;slice \u5fc5\u987b\u62f7\u8d1d&#xff0c;string \u4e0d\u7528&#xff09;&#xff1b;\u8981\u6240\u6709\u65b9\u6848\u5c31\u6536\u96c6\u540e\u7ee7\u7eed&#xff0c;\u522b\u77ed\u8def<\/li>\n<li class=\"task-list-item\"> \u8fd8\u539f&#xff1a;\u505a\u9009\u62e9\/\u9012\u5f52\/\u8fd8\u539f\u4e09\u8fde&#xff0c;\u4e00\u4e2a\u4e0d\u80fd\u5c11&#xff1b;\u505a\u4e86\u591a\u5c11\u52a8\u4f5c\u5c31\u64a4\u9500\u591a\u5c11&#xff08;N \u7687\u540e\u662f\u56db\u52a8\u4f5c\u5bf9&#xff09;<\/li>\n<li class=\"task-list-item\"> \u53bb\u91cd&#xff1a;\u9898\u9762\u6709&#034;\u542b\u91cd\u590d\u5143\u7d20&#034;\u2192 \u6392\u5e8f &#043; \u540c\u5c42\u53bb\u91cd&#xff1b;\u4e0d\u80fd\u6392\u5e8f \u2192 \u5c42\u5185\u54c8\u5e0c\u96c6\u5408<\/li>\n<li class=\"task-list-item\"> \u526a\u679d&#xff1a;\u5408\u6cd5\u6027&#xff08;\u8fd9\u4e2a\u9009\u62e9\u975e\u6cd5&#xff09;&#043; \u53ef\u884c\u6027&#xff08;\u5b50\u6811\u5fc5\u6b7b&#xff09;\u4e24\u5c42\u90fd\u8981\u60f3&#xff1b;break \u7684\u8d44\u683c\u662f\u5355\u8c03\u6027&#xff08;\u6392\u5e8f\u7ed9\u7684&#xff0c;\u6216\u5207\u5272\u957f\u5ea6\u5929\u7136\u7ed9\u7684&#xff09;&#xff0c;\u4e0d\u662f\u6392\u5e8f\u672c\u8eab<\/li>\n<li class=\"task-list-item\"> \u8bb0\u5fc6\u5316&#xff1a;\u72b6\u6001\u4e0e\u8def\u5f84\u5206\u79bb\u5417&#xff1f;\u5206\u79bb \u2192 \u7f13\u5b58\u7ed3\u8bba&#xff08;\u80fd\u5426\/\u4ea7\u51fa\/\u957f\u5ea6&#xff09;&#xff0c;\u4e0d\u7f13\u5b58\u9009\u62e9<\/li>\n<\/ul>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u4e0b\u534a\u573a\u7684\u5b66\u4e60\u8f68\u8ff9&#xff1a;<\/p>\n<p>139 \u8303\u5f0f\u9677\u9631 &#043; 417 \u4e07\u6b21\u8c03\u7528\u7684\u8d85\u65f6\u73b0\u573a&#xff08;\u8bb0\u5fc6\u5316\u5224\u636e\u7acb\u4f4f&#xff09;<br \/>\n   \u2193<br \/>\n140 \u8bb0\u5fc6\u5316\u4e09\u6b21\u9519\u4f4d&#xff08;\u7f13\u5b58\u9009\u62e9 \u2192 \u7f13\u5b58\u5019\u9009 \u2192 \u7f13\u5b58\u7ed3\u8bba&#xff09;<br \/>\n   \u2193<br \/>\n491 \u6392\u5e8f\u88ab\u7981&#xff08;\u53bb\u91cd\u7b2c\u56db\u8f7d\u4f53&#xff1a;\u5c42\u5185\u96c6\u5408&#xff09;<br \/>\n   \u2193<br \/>\n79 \u4e2d\u95f4\u6001\u5931\u63a7&#xff08;1GB \u6808\u6ea2\u51fa&#xff0c;\u7c92\u5ea6\u8fc7\u788e\u7684\u7ffb\u8f66&#xff09;<br \/>\n   \u2193<br \/>\n51 N \u7687\u540e&#xff08;\u72b6\u6001\u8bbe\u8ba1\u5d29\u584c \u2192 \u5bf9\u89d2\u7ebf\u7f16\u53f7 \u2192 \u4e09\u4e2a\u6807\u8bb0\u6570\u7ec4&#xff09;<br \/>\n   \u2193<br \/>\n\u771f\u6b63\u6bd5\u4e1a<\/p>\n<p>\u611f\u89e6\u6700\u6df1\u7684\u4e09\u4e2a&#xff1a;<\/p>\n<p>\u6a21\u677f\u662f\u5ec9\u4ef7\u7684&#xff0c;\u51b3\u7b56\u8bbe\u8ba1\u624d\u662f\u56de\u6eaf\u7684\u7075\u9b42\u3002\u6240\u6709\u7ffb\u8f66\u91cc&#xff0c;\u6ca1\u6709\u4e00\u6b21\u662f&#034;\u5faa\u73af\u4e09\u8fde\u5199\u9519\u4e86&#034;&#xff0c;\u5168\u662f\u683d\u5728&#034;\u6bcf\u5c42\u51b3\u7b56\u662f\u4ec0\u4e48&#034;\u8fd9\u4e2a\u4e0a\u6e38\u95ee\u9898\u4e0a\u2014\u2014\u7c92\u5ea6\u8fc7\u7c97&#xff08;\u62ec\u53f7&#xff09;\u3001\u7c92\u5ea6\u8fc7\u788e&#xff08;\u7f51\u683c&#xff09;\u3001\u6a21\u578b\u9519\u914d&#xff08;\u8981\u4e0d\u8981\u6ee5\u7528&#xff09;\u3001\u4e2d\u95f4\u6001\u5931\u63a7&#xff08;step \u673a\u5236&#xff09;\u3002<\/p>\n<p>\u72b6\u6001\u8bbe\u8ba1\u662f\u7b2c\u4e8c\u7075\u9b42\u3002\u4e0b\u534a\u573a\u7684\u4e09\u8bb0\u91cd\u9524&#xff08;\u8bb0\u5fc6\u5316\u3001\u53bb\u91cd\u7b2c\u56db\u8f7d\u4f53\u3001\u4e2d\u95f4\u6001&#xff09;\u5168\u90fd\u6307\u5411\u540c\u4e00\u4ef6\u4e8b&#xff1a;\u72b6\u6001\u662f\u4ec0\u4e48\u3001\u72b6\u6001\u548c\u8def\u5f84\u4ec0\u4e48\u5173\u7cfb\u3001\u72b6\u6001\u600e\u4e48\u8868\u793a\u3002\u628a\u8fd9\u4e09\u95ee\u60f3\u6e05\u695a&#xff0c;\u4e00\u534a\u7684\u5751\u5728\u5199\u4ee3\u7801\u4e4b\u524d\u5c31\u80fd\u6392\u6389\u3002<\/p>\n<p>\u540c\u4e00\u4e2a\u8003\u70b9\u4f1a\u5728\u4e0d\u540c\u9898\u91cc\u53cd\u590d\u4f0f\u51fb\u4f60\u3002\u53bb\u91cd\u56db\u8fde\u6f0f\u3001\u8bb0\u5fc6\u5316\u4e09\u8fde\u9519\u2014\u2014\u6bcf\u6b21\u90fd\u662f&#034;\u770b\u61c2\u4e86\u9898\u89e3&#034;\u548c&#034;\u80fd\u5bf9\u7740\u522b\u4eba\u8bb2\u660e\u767d&#034;\u4e4b\u95f4\u7684\u5dee\u8ddd\u3002\u9519\u9898\u4e0d\u80fd\u53ea\u662f\u770b\u61c2&#xff0c;\u8981\u80fd\u63a8\u6f14&#xff08;8 \u6761\u8def\u5f84\u8868&#xff09;\u3001\u8981\u80fd\u91cf\u5316&#xff08;417 \u4e07\u6b21\u8c03\u7528&#xff09;\u3001\u8981\u80fd\u91cd\u5199&#xff08;\u6bcf\u4e00\u8282\u7684\u4fee\u6b63\u7248\u6211\u90fd\u91cd\u65b0\u5199\u4e86\u4e00\u904d&#xff09;\u3002<\/p>\n<p>\u8bf4\u5b9e\u8bdd&#xff0c;\u8fd9\u4e2a\u8fc7\u7a0b\u6bd4\u60f3\u8c61\u4e2d\u96be\u53d7&#xff0c;\u6bcf\u4e2a\u65b0\u9898\u578b\u90fd\u6709\u65b0\u9519\u6cd5\u3002\u4f46\u4e5f\u771f\u5b9e\u611f\u53d7\u5230\u4e86\u6536\u655b&#xff1a;\u4ece\u62ec\u53f7\u9898\u6574\u9898\u5efa\u6a21\u9519\u8bef&#xff0c;\u5230 N \u7687\u540e\u5d29\u584c\u540e\u4e00\u6b21\u91cd\u5199\u5c31\u8fc7\u89e3\u6570\u5e8f\u5217\u9a8c\u8bc1\u3002\u7b97\u6cd5\u80fd\u529b\u5c31\u662f\u8fd9\u4e48\u4e00\u70b9\u70b9\u78e8\u51fa\u6765\u7684&#xff0c;\u6ca1\u6709\u94f6\u5f39\u3002\u4ee5\u540e\u8fd8\u9700\u8981\u7ee7\u7eed\u52aa\u529b\u3002\u52a0\u6cb9&#xff01;<\/p>\n<p>\u6700\u540e\u7559\u4e00\u4e2a\u63a5\u53e3&#xff1a;\u672c\u7bc7\u7b2c\u4e00\u7ae0&#034;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#034;\u91cc&#xff0c;\u201c\u7f13\u5b58\u7ed3\u8bba\u3001\u72b6\u6001\u4e0e\u8def\u5f84\u5206\u79bb\u3001\u591a\u6761\u8def\u5f84\u574d\u7f29\u5230\u540c\u4e00\u72b6\u6001\u201d\u2014\u2014\u8fd9\u4e09\u53e5\u8bdd\u6b63\u662f\u52a8\u6001\u89c4\u5212\u7684\u5165\u573a\u5238\u3002\u56de\u6eaf\u52a0\u8bb0\u5fc6\u5316\u518d\u53bb\u6389\u9012\u5f52&#xff0c;\u5c31\u662f DP\u3002\u63a5\u4e0b\u6765\u7684\u52a8\u6001\u89c4\u5212\u7cfb\u5217&#xff0c;\u5c31\u4ece\u8fd9\u91cc\u51fa\u53d1\u3002<\/p>\n<h3>\u53c2\u8003\u8d44\u6599<\/h3>\n<ul>\n<li>LeetCode 139. \u5355\u8bcd\u62c6\u5206<\/li>\n<li>LeetCode 140. \u5355\u8bcd\u62c6\u5206 II<\/li>\n<li>LeetCode 491. \u9012\u589e\u5b50\u5e8f\u5217<\/li>\n<li>LeetCode 79. \u5355\u8bcd\u641c\u7d22<\/li>\n<li>LeetCode 51. N \u7687\u540e<\/li>\n<\/ul>\n<hr \/>\n<p>\u7248\u6743\u58f0\u660e&#xff1a;\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0&#xff0c;\u9075\u5faa CC 4.0 BY-SA \u7248\u6743\u534f\u8bae&#xff0c;\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u548c\u672c\u58f0\u660e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e09&#xff09;&#xff1a;\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597<br \/>\n\u6458\u8981<br \/>\n\u56de\u6eaf\u7cfb\u5217\u7b2c\u4e09\u7bc7&#xff0c;\u6536\u5b98\u3002\u4e0a\u4e00\u7bc7\u4ee5 LC842 \u9a8c\u6536\\&#8221;\u6bd5\u4e1a\\&#8221;&#xff0c;\u6211\u4ee5\u4e3a\u771f\u6bd5\u4e1a\u4e86\u2014\u2014\u63a5\u4e0b\u6765\u4e09\u8bb0\u91cd\u9524\u9524\u9192\u4e86\u68a6&#xff1a;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#xff08;417 \u4e07\u6b21\u8c03\u7528 vs 176 \u6b21&#xff0c;\u7f13\u5b58\u9009\u62e9\u3001\u7f13\u5b58\u5019\u9009\u3001\u53ea\u5199\u4e0d\u8bfb\u4e00\u8def\u8e29\u8fc7\u53bb&#xff09;\u3001\u6392\u5e8f\u88ab\u7981\u540e\u7684\u53bb\u91cd&#xff08;\u5c42\u5c5e\u6027 vs \u8def\u5f84\u5c5e\u6027&#xff0c;u<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7644,11582,745,2692,427],"topic":[],"class_list":["post-101273","post","type-post","status-publish","format-standard","hentry","category-server","tag-7644","tag-11582","tag-go","tag-leetcode","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/101273.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e09&#xff09;&#xff1a;\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 \u6458\u8981 \u56de\u6eaf\u7cfb\u5217\u7b2c\u4e09\u7bc7&#xff0c;\u6536\u5b98\u3002\u4e0a\u4e00\u7bc7\u4ee5 LC842 \u9a8c\u6536&quot;\u6bd5\u4e1a&quot;&#xff0c;\u6211\u4ee5\u4e3a\u771f\u6bd5\u4e1a\u4e86\u2014\u2014\u63a5\u4e0b\u6765\u4e09\u8bb0\u91cd\u9524\u9524\u9192\u4e86\u68a6&#xff1a;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#xff08;417 \u4e07\u6b21\u8c03\u7528 vs 176 \u6b21&#xff0c;\u7f13\u5b58\u9009\u62e9\u3001\u7f13\u5b58\u5019\u9009\u3001\u53ea\u5199\u4e0d\u8bfb\u4e00\u8def\u8e29\u8fc7\u53bb&#xff09;\u3001\u6392\u5e8f\u88ab\u7981\u540e\u7684\u53bb\u91cd&#xff08;\u5c42\u5c5e\u6027 vs \u8def\u5f84\u5c5e\u6027&#xff0c;u\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/101273.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-06T07:17:07+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101273.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/101273.html\",\"name\":\"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-06T07:17:07+00:00\",\"dateModified\":\"2026-09-06T07:17:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/101273.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/101273.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/101273.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/101273.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5&#xff08;\u4e09&#xff09;&#xff1a;\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 \u6458\u8981 \u56de\u6eaf\u7cfb\u5217\u7b2c\u4e09\u7bc7&#xff0c;\u6536\u5b98\u3002\u4e0a\u4e00\u7bc7\u4ee5 LC842 \u9a8c\u6536\"\u6bd5\u4e1a\"&#xff0c;\u6211\u4ee5\u4e3a\u771f\u6bd5\u4e1a\u4e86\u2014\u2014\u63a5\u4e0b\u6765\u4e09\u8bb0\u91cd\u9524\u9524\u9192\u4e86\u68a6&#xff1a;\u8bb0\u5fc6\u5316\u7684\u4e09\u6b21\u9519\u4f4d&#xff08;417 \u4e07\u6b21\u8c03\u7528 vs 176 \u6b21&#xff0c;\u7f13\u5b58\u9009\u62e9\u3001\u7f13\u5b58\u5019\u9009\u3001\u53ea\u5199\u4e0d\u8bfb\u4e00\u8def\u8e29\u8fc7\u53bb&#xff09;\u3001\u6392\u5e8f\u88ab\u7981\u540e\u7684\u53bb\u91cd&#xff08;\u5c42\u5c5e\u6027 vs \u8def\u5f84\u5c5e\u6027&#xff0c;u","og_url":"https:\/\/www.wsisp.com\/helps\/101273.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-06T07:17:07+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/101273.html","url":"https:\/\/www.wsisp.com\/helps\/101273.html","name":"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-06T07:17:07+00:00","dateModified":"2026-09-06T07:17:07+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/101273.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/101273.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/101273.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u7b97\u6cd5\u3011\u56de\u6eaf\u7b97\u6cd5\uff08\u4e09\uff09\uff1a\u4e09\u8bb0\u91cd\u9524\u4e0e N \u7687\u540e\u2014\u2014\u8bb0\u5fc6\u5316\u3001\u72b6\u6001\u8bbe\u8ba1\u4e0e\u4e09\u5c42\u6f0f\u6597"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/101273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=101273"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/101273\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=101273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=101273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=101273"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=101273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}