/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
struct ListNode* pre;
bool judge(struct ListNode* head){
if(!head) return true;
bool temp=judge(head->next);
if(!temp) return false;
if(head->val!=pre->val) return false;
pre=pre->next;
return true;
}
bool isPalindrome(struct ListNode* head) {
pre=head;
return judge(head);
}
标签:pre,head,ListNode,struct,val,链表,234,return,回文 From: https://www.cnblogs.com/llllmz/p/18076308