此题注意事项:
当head为null,返回null;.
当head.next为null,然后head;
1.通过快慢指针,得到链的中点.
初始化:
slow=head;
fast=head.next==null?null:head.next.next;
2.找到中心node之后。
切断链,
newNode=slow.next;
slow.next=null;
3.之后对newNode,反转
4.重新合并一个新的链
null指针的原因在于:
newNode的节点,可能为null。head的节点不为null。