class Solution { public: ListNode* ReverseList(ListNode* pHead) { ListNode * linkList = new ListNode(0); ListNode * p = pHead; ListNode * nextP = p->next; while(p){ p->next = linkList->next; linkList->next = p; p = nextP; nextP = nextP->next; } return linkList->next; } };
原文:https://www.cnblogs.com/ttzz/p/13281308.html