public class Solution {
public ListNode ReverseList(ListNode head) {
if(head==null||head.next==null)
return head;
ListNode cur=head;
ListNode pre=null;
ListNode next=null;
while(cur!=null)
{
next=cur.next;
cur.next=pre;
pre=cur;
cur=next;
}
return pre;
}
}

一道语法题目
利用三个指针,其实跟swap有点像,当前节点等于下一个,下一个等于前一个,前一个等于现在的,现在的只想下一个