{"id":4073,"date":"2023-11-04T11:29:34","date_gmt":"2023-11-04T03:29:34","guid":{"rendered":"https:\/\/white-night.club\/?p=4073"},"modified":"2023-11-09T11:07:43","modified_gmt":"2023-11-09T03:07:43","slug":"ad127","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/11\/04\/ad127\/","title":{"rendered":"LCR 141.\u00a0\u8bad\u7ec3\u8ba1\u5212 III (Go)"},"content":{"rendered":"\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5934\u8282\u70b9\u4e3a\u00a0<code>head<\/code>\u00a0\u7684\u5355\u94fe\u8868\u7528\u4e8e\u8bb0\u5f55\u4e00\u7cfb\u5217\u6838\u5fc3\u808c\u7fa4\u8bad\u7ec3\u7f16\u53f7\uff0c\u8bf7\u5c06\u8be5\u7cfb\u5217\u8bad\u7ec3\u7f16\u53f7\u00a0<strong>\u5012\u5e8f<\/strong>\u00a0\u8bb0\u5f55\u4e8e\u94fe\u8868\u5e76\u8fd4\u56de\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>head = [1,2,3,4,5]\n<strong>\u8f93\u51fa\uff1a<\/strong>[5,4,3,2,1]\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>head = [1,2]\n<strong>\u8f93\u51fa\uff1a<\/strong>[2,1]\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 3\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>head = []\n<strong>\u8f93\u51fa\uff1a<\/strong>[]\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li>\u94fe\u8868\u4e2d\u8282\u70b9\u7684\u6570\u76ee\u8303\u56f4\u662f&nbsp;<code>[0, 5000]<\/code><\/li>\n\n\n\n<li><code>-5000 &lt;= Node.val &lt;= 5000<\/code><\/li>\n<\/ul>\n\n\n\n<p><strong>\u6ce8\u610f<\/strong>\uff1a\u672c\u9898\u4e0e\u4e3b\u7ad9 206 \u9898\u76f8\u540c\uff1a<a href=\"https:\/\/leetcode-cn.com\/problems\/reverse-linked-list\/\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0086ff\" class=\"has-inline-color\">https:\/\/leetcode-cn.com\/problems\/reverse-linked-list\/<\/mark><\/a><\/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>Go\u9012\u5f52<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u4ee4\u4eba\u611f\u6168\u3002\u94fe\u8868\u5df2\u7ecf\u6210\u4e86\u6211\u5fc3\u4e2d\u7684\u75db\u3002\u9012\u5f52\u4e5f\u662f\u3002\u89c1\u4e00\u6b21\u8dea\u4e00\u6b21\uff0c\u8fc7\u51e0\u5929\u597d\u597d\u5199\u4e2a\u94fe\u8868\u719f\u6089\u719f\u6089\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\r\n * Definition for singly-linked list.\r\n * type ListNode struct {\r\n *     Val int\r\n *     Next *ListNode\r\n * }\r\n *\/\r\nfunc trainningPlan(head *ListNode) *ListNode {\r\n    if head==nil||head.Next==nil{\r\n        return head\r\n    }\r\n    newHead:=trainningPlan(head.Next)\r\n    head.Next.Next=head\r\n    head.Next=nil\r\n    return newHead\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u9012\u5f52\u5012\u7f6e\u94fe\u8868\uff08Go\u5b9e\u73b0\uff09<\/p>\n","protected":false},"author":1,"featured_media":2827,"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\/4073"}],"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=4073"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/4073\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=4073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=4073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=4073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}