// Reverse the right half list. while (curr != null) { ListNodenext= curr.next; curr.next = prev; prev = curr; curr = next; }
// Two pointers. One from the left, the other from the right. ListNodeleft= head; ListNoderight= prev; while (right != null) { if (left.val != right.val) returnfalse; left = left.next; right = right.next; } returntrue; } }