//DAY2.A
//题源:ACWING 反转链表
//参考:https://www.acwing.com/problem/content/33/
class Solution {
public:
ListNode* reverseList(ListNode* head) {
ListNode*p=NULL;
auto cur=head;
while(cur)
{
auto next = cur -> next;
cur -> next= p;
p = cur;
cur = next;
}
return p;
}
};
考察知识点:数据结构 算法
单链表相关内容



