{"id":214,"date":"2020-01-16T20:09:15","date_gmt":"2020-01-16T12:09:15","guid":{"rendered":"https:\/\/twocups.cn\/?p=214"},"modified":"2021-03-21T18:18:37","modified_gmt":"2021-03-21T10:18:37","slug":"14","status":"publish","type":"post","link":"https:\/\/twocups.cn\/index.php\/2020\/01\/16\/14\/","title":{"rendered":"\u3010\u7b97\u6cd5\u3011\u53cd\u8f6c\u94fe\u8868\u2014\u2014\u9012\u5f52\u89e3\u6cd5"},"content":{"rendered":"\n<h4><img width=\"80\" src=\"https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a.png\" alt=\"\" class=\"wp-image-152\" srcset=\"https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a.png 3337w, https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a-300x125.png 300w, https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a-1024x426.png 1024w, https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a-768x320.png 768w, https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a-1536x639.png 1536w, https:\/\/twocups.cn\/wp-content\/uploads\/2019\/12\/logo\u6a2a-2048x852.png 2048w\" sizes=\"(max-width: 3337px) 100vw, 3337px\" \/>\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\uff1a<a href=\"https:\/\/twocups.cn\/index.php\/2020\/01\/16\/14\/\">https:\/\/twocups.cn\/index.php\/2020\/01\/16\/14\/<\/a><\/h4>\n\n\n\n<p>\u6700\u8fd1\u6211\u9047\u5230\u4e86<strong>\u201c\u53cd\u8f6c\u94fe\u8868\u201d<\/strong>\u8fd9\u9053\u7b97\u6cd5\u9898\uff0c\u53d1\u73b0\u7528\u9012\u5f52\u89e3\u7684\u4eba\u5f88\u5c11\uff08LeetCode\u7684\u5b98\u65b9\u7b54\u6848\u4e2d\u5c31\u6709\u7528\u9012\u5f52\u89e3\u7684\uff0c\u4f46\u90a3\u4e2a\u7b54\u6848\u4e0d\u592a\u597d\u7406\u89e3\uff09\u3002\u5176\u5b9e<strong>\u9012\u5f52\u601d\u60f3<\/strong>\u771f\u7684\u975e\u5e38\u9002\u5408\u89e3\u51b3\u5355\u5411\u94fe\u8868\u7684\u9898\u76ee\uff0c\u56e0\u4e3a\u5bf9\u5355\u5411\u94fe\u8868\u4f7f\u7528\u9012\u5f52\u65f6\uff0c\u76f8\u5f53\u4e8e\u80fd\u53cd\u5411\u904d\u5386\u4e00\u904d\u94fe\u8868\uff0c\u4f7f\u5355\u5411\u94fe\u8868\u5177\u5907\u53cc\u5411\u94fe\u8868\u7684\u5c5e\u6027\u3002\u8fd9\u91cc\u662f\u63d0\u4f9b\u4e00\u79cd\u9012\u5f52\u89e3\u6cd5\u7684\u601d\u8def\uff0c\u4e0d\u662f\u8bf4\u9012\u5f52\u89e3\u6cd5\u662f\u6700\u597d\u7684\u3002<\/p>\n\n\n\n<h2>\u9898\u76ee\u63cf\u8ff0<\/h2>\n\n\n\n<p>\u8f93\u5165\u4e00\u4e2a\u94fe\u8868\uff0c\u53cd\u8f6c\u94fe\u8868\u540e\uff0c\u8f93\u51fa\u65b0\u94fe\u8868\u7684\u8868\u5934\u3002<\/p>\n\n\n\n<h4>\u94fe\u8868\u7ed3\u6784<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class ListNode {\n    int val;\n    ListNode next = null;\n    ListNode(int val) {\n        this.val = val;\n    }\n}<\/pre>\n\n\n\n<h2>\u4ea4\u6362\u4f4d\u7f6e\u89e3\u6cd5<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public ListNode ReverseList(ListNode head) {\n    if(head==null)\n        return null;\n    ListNode newHead = null;\n    ListNode pNode = head;\n    ListNode pPrev = null;\n    while(pNode!=null){\n        ListNode pNext = pNode.next;\n        if(pNext==null)\n            newHead = pNode;\n        pNode.next = pPrev;\n        pPrev = pNode;\n        pNode = pNext;\n    }\n    return newHead;\n}<\/pre>\n\n\n\n<h2>\u9012\u5f52\u89e3\u6cd5<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ListNode newln,p;\npublic ListNode ReverseList(ListNode head) {\n    this.tempReverseList(head,-1,false);\n    return newln;\n}\nvoid tempReverseList(ListNode head,int val,boolean b){\n    if(head !=null){\n        this.tempReverseList(head.next,head.val,true);\n        if(b == true){\n            p.next = new ListNode(val);\n            p = p.next;\n        }\n    }else{\n        if(b == true) p = newln = new ListNode(val);\n    }\n}<\/pre>\n\n\n\n<h2>\u9012\u5f52\u89e3\u6cd5\u8fdb\u9636\u7248<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"classic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public ListNode ReverseList(ListNode head) {\n    if(head == null) return null;\n    if(head.next == null) return head;\n    ListNode node = reverseList(head.next);\n    head.next.next = head;\n    head.next = null;\n    return node;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\uff1ahttps:\/\/twocups.cn\/index.php\/202 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":56,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[76],"tags":[77,79,78],"_links":{"self":[{"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/posts\/214"}],"collection":[{"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/comments?post=214"}],"version-history":[{"count":0,"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/posts\/214\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/media\/56"}],"wp:attachment":[{"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/media?parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/categories?post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/twocups.cn\/index.php\/wp-json\/wp\/v2\/tags?post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}