反转链表
public class Solution {
public ListNode reverseList(ListNode head) {
ListNode H=new ListNode(0);
H.next=null;
ListNode p=head;
while(p!=null)
{
ListNode x=p;
p=p.next;
x.next=H.next;
H.next=x;
}
return H.next;
}
}
Leetcode#206Reverse Linked List
原文地址:http://7061299.blog.51cto.com/7051299/1641964