反转一个单链表。
示例:
输入: 1->2->3->4->5->NULL 输出: 5->4->3->2->1->NULL
struct ListNode* reverseList(struct ListNode* head){
struct ListNode *pre = NULL;
struct ListNode *curr = head; while(curr)
{
struct ListNode *next = curr->next;
curr->next = pre;
pre = curr;
curr = next;
}
return pre;
}