/*
 * function ListNode(x){
 *   this.val = x;
 *   this.next = null;
 * }
 */

/**
 *
 * @param head ListNode类 the head
 * @return bool布尔型
 */
function isPail(head) {
    // write code here
    
    const res = []
    while(head){
        res.push(head.val)
        head=head.next
    }
    if (res.length===1)return true
    let i =0;
    j=res.length-1
    while(i<j){
        if(res[i]!=res[j]){return false}
        i++
        j--
    }
    return true
    
}
module.exports = {
    isPail: isPail,
};