题解 | #判断一个链表是否为回文结构#
判断一个链表是否为回文结构
https://www.nowcoder.com/practice/3fed228444e740c8be66232ce8b87c2f
function isPail(head){ let arr=[],res=[] while(head!=null){ arr.push(head.val) head=head.next } res=arr.slice() arr.reverse() for(let i=0;i<arr.length;i++){ if(arr[i]!=res[i]){ return false } } return true }