leetcode206_反转链表_迭代+递归

一. 迭代函数 1. 有pre, cur还要保存cur->next.3d class Solution { public: ListNode* reverseList(ListNode* head) { if(head==NULL || head->next==NULL) return head; //前驱指针,cur须要指向它.
相关文章
相关标签/搜索