/**
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
class Solution {
public:
/**
*
* @param head ListNode类 the head
* @return bool布尔型
*/
bool isPail(ListNode* head)
{
// write code here
vector<ListNode *>vec;
while(head!=NULL)
{
vec.push_back(head);
head = head->next;
}
int i = 0;
int j = vec.size() - 1;
while(i<j)
{
if (vec[i]->val != vec[j]->val)
{
return false;
}
i++;
j--;
}
return true;
}
};