class Solution { public: ListNode* ReverseList(ListNode* pHead) { if (pHead==NULL) return pHead; ListNode*pre=pHead,*p,*post; p=pre->next; pre->next=NULL; while(p!=NULL) { post=p->next; p->next=pre; pre=p; p=post; } pHead=pre; return pHead; } };