206. Reverse Linked List
思路:迭代,将链表分为头结点head和后续链表reslist。假设reslist已完成反转,relist的头结点为rehead: rehead->head;head->null;
public ListNode reverseList(ListNode head) {
if (head==null||head.next==null) return head;
ListNode p = reverseList(head.next);
head.next.next = head;
head.next = null;
return p;
}