请牢记检测回文串的模板
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
bool isPalindrome(struct ListNode* head) {
int size=0;
struct ListNode* point=head;
while(point)
{
size++;
point=point->next;
}
int arr[size];
int num = 0;
while(head)
{
arr[num++]= head->val;
head = head->next;
}
int kuai = num - 1;
int man = 0;
while(man < kuai)
{
if(arr[man] != arr[kuai])
{
return false;
}
man++;
kuai--;
}
return true;
}