class Solution {
public ListNode reverseList(ListNode head) {
/
//递归
if(head==null||head.next==null){
return head;
}
ListNode p = reverseList(head.next);
head.next.next =head;
head.next = null;
return p;
/
if(head==null){return head;}
ListNode q=head;ListNode p = null;
while(q.next!=null){
ListNode k = q;
q=q.next;
k.next=p;
p=k;
}
q.next =p;
return q;
}
}