/*
struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};*/
class PalindromeList {
public:
    bool chkPalindrome(ListNode* A) {
        // write code here
        vector<int> v;


        while(A != nullptr)
        {
            v.push_back(A->val);
            A = A->next;
        }

        int left = 0;
        int right = v.size()-1;

        while(left < right)
        {
            if(v[left] != v[right])
            {
                return false;
            }
            left++;
            right--;
        }

        return true;
    }
};