function isPail( head ) { let arr1=[],arr2=[] let cur=head while(cur){ arr1.push(cur.val) arr2.push(cur.val) cur=cur.next } arr1.reverse() for(let i=0;i<arr1.length;i++){ if(arr1[i]!=arr2[i]){ return false } } return true } // module.exports = { // isPail : isPail // };