class Solution {
public:
ListNode* reverseList(ListNode* head) {
if( head== nullptr )
return head;
if( head->next == nullptr)
return head;
ListNode* p = reverseList(head->next);
head->next->next=head;
head->next = nullptr;
return p;
}
};
leetcode 206 反转链表
于 2019-12-12 22:09:47 首次发布