ListNode * reverseList(ListNode * list) {
if ( list == NULL || list ->next == NULL) //链表为空直接返回,而 list ->next为空是递归基
return list;
ListNode * newHead = reverseList( list ->next); //一直循环到链尾
list ->next->next = list ; //翻转链表的指向
list ->next = NULL; //记得赋值NULL,防止链表错乱
return newHead; //新链表头永远指向的是原链表的链尾
}