面试题16:反转链表 题目:定义一个函数,输入一个链表的头结点,反转该链表并输出反转后链表的头结点。链表结点定义如下: 1 struct ListNode 2 { 3 int val; 4 ListNode* next; 5 }; 参见LeetNode-Reverse Linked List。