206. 反转链表

class Solution { public: ListNode* reverseList(ListNode* head) { if (head == nullptr) return nullptr; ListNode* a = nullptr; while (head != nullptr) { ListNode* t = head->next; head->next = a; a = head; head = t; } return a; } };