class Solution
{
public:
ListNode *reverseList(ListNode *head)
{
ListNode *myHead = nullptr;
while (head != nullptr)
{
ListNode *tmp = head->next;
head->next = myHead;
myHead = head;
head = tmp;
}
return myHead;
}
};
206. 反转链表【cpp】
猜你喜欢
转载自blog.csdn.net/Mason97/article/details/107845712
今日推荐
周排行