#include<iostream>
using namespace std;
class solution{
public:
ListNode reverse(ListNode* head){
ListNode *dummpy = new ListNode(-1);
ListNode *pre = head;
ListNode *cur = head->next;
while(cur->next !=NULL){
ListNode *tmp = cur->next;
cur->next = pre;
pre->next = tmp;
cur = tmp;
head = cur;
}
return dumppy->next;
}
}
06-14
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交