題目描述
public class Solution {
public ListNode ReverseList(ListNode head) {
ListNode newHead=null;
ListNode next=null;
ListNode p=head;
if(head==null)
return null;
while(p!=null){
next=p.next;
p.next=newHead;
newHead=p;
p=next;
}
return newHead;
}