时间复杂度(O( n))
class Solution {
public:
ListNode* reverseList(ListNode* head) {
if(head==NULL||head->next==NULL)return head;
ListNode* p = head;
while(p->next!=NULL){
ListNode* q = p->next;;
p->next = p->next->next;
q->next=head;
head = q;
}
return head;
}
};class Solution {
public: