{"id":172605,"date":"2020-10-26T05:57:55","date_gmt":"2020-10-25T21:57:55","guid":{"rendered":"http:\/\/4563.org\/?p=172605"},"modified":"2020-10-26T05:57:55","modified_gmt":"2020-10-25T21:57:55","slug":"%e5%8a%9b%e6%89%a3-%e5%9b%9e%e6%96%87%e9%93%be%e8%a1%a8%ef%bc%8c%e6%88%91%e5%86%99%e7%9a%84%e9%80%92%e5%bd%92%e6%80%8e%e4%b9%88%e6%98%af%e9%94%99%e7%9a%84","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=172605","title":{"rendered":"\u529b\u6263 \u56de\u6587\u94fe\u8868\uff0c\u6211\u5199\u7684\u9012\u5f52\u600e\u4e48\u662f\u9519\u7684"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u529b\u6263 \u56de\u6587\u94fe\u8868\uff0c\u6211\u5199\u7684\u9012\u5f52\u600e\u4e48\u662f\u9519\u7684               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : amiwrong123 <\/span>  <span><i><\/i> 9<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>https:\/\/leetcode-cn.com\/problems\/palindrome-linked-list\/solution\/hui-wen-lian-biao-by-leetcode\/<\/p>\n<p>\u5b98\u65b9\u7b54\u6848\u9012\u5f52\uff1a<\/p>\n<pre><code>class Solution {      private ListNode frontPointer;      private boolean recursivelyCheck(ListNode currentNode) {         if (currentNode != null) {             if (!recursivelyCheck(currentNode.next)) return false;             if (currentNode.val != frontPointer.val) return false;             frontPointer = frontPointer.next;         }         return true;     }      public boolean isPalindrome(ListNode head) {         frontPointer = head;         return recursivelyCheck(head);     } } <\/code><\/pre>\n<p>\u6211\u5199\u7684\u611f\u89c9\u6267\u884c\u8fc7\u7a0b\u662f\u4e00\u6837\u7684\u554a\uff0c\u770b\u61f5\u4e86\uff0c\u5927\u4f6c\u4eec\u5e2e\u5fd9\u770b\u770b\u3002<\/p>\n<pre><code>class Solution {     private ListNode frontPointer;      private boolean recursion(ListNode currentNode){         if (currentNode.next == null){             return true;         }         if (!recursion(currentNode.next))              return false;         boolean result = frontPointer.val == currentNode.val;         frontPointer = frontPointer.next;         return result;     }      public boolean isPalindrome(ListNode head) {         frontPointer = head;         return recursion(head);     } } <\/code><\/pre>\n<p>\u8f93\u5165\uff1a [1,2] \u8f93\u51fa\uff1a true \u9884\u671f\u7ed3\u679c\uff1a false<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3803597\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : amiwrong123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u521a\u53d1\u5b8c\u8d34\u5c31\u53d1\u73b0\uff0c\u81ea\u5df1\u54ea\u91cc\u9519\u4e86\u3002\u3002\u3002if (currentNode.next == null)\u5e94\u8be5\u662f if (currentNode== null)\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u529b\u6263 \u56de\u6587\u94fe\u8868\uff0c\u6211\u5199\u7684\u9012\u5f52\u600e\u4e48\u662f\u9519&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172605"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=172605"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172605\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172605"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}