/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
private:
vector<int>v;
public:
bool isPalindrome(ListNode* head) {
if(!head) return true;
while(head)
{
v.push_back(head->val);
head = head->next;
}
vector<int>v1 = v;
reverse(v1.begin(),v1.end());
return v == v1;
}
};