public boolean isPail (ListNode head) {
// write code here
if (head.next == null){
return true;
}
if (head.next.next == null){
return false;
}
ListNode slow = head;
ListNode fast = head;
while (fast != null && fast.next != null){
slow = slow.next;
fast = fast.next.next;
}
ListNode reserveList = reserve(slow);
ListNode pre = reserveList;
ListNode cur = head;
while (pre.next != null && cur.next !=null){
if (pre.val != cur.val){
ret
牛客网hoot200(二)
猜你喜欢
转载自blog.csdn.net/qq_50156012/article/details/123999845
今日推荐
周排行