思路:递归相当于栈!利用栈的先入后出特性
实现代码:
if (head == null || head.next == null) {
return head;
}
ListNode p = reverseList(head.next);
head.next.next = head;
head.next = null;
return p;