55561bc4创建于 2022年12月27日历史提交
class Solution{    
    public:    
        bool isPalindrome(ListNode* head){            
            vector<int> v;            
            while(head != nullptr){                
                v.push_back(head -> val);                
                head = head -> next;              
            }         
            for(int i = 0; i < v.size() / 2; i++){                
                if(v[i] != v[v.size() - i - 1]){                    
                    return false;                    
                }                
            }            
            return true;
        }    
};