直接的从第一个node开始 记录一下 下一个node 然后就开始挪动当前node的指针
记得要把最开始的node.next = null
public class Solution {
public ListNode reverseList(ListNode head) {
if ( head == null || head.next == null )
return head;
ListNode newHead = null;
while ( head != null ){
ListNode next = head.next;
head.next = newHead;
newHead = head;
head = next;
}
return newHead;
}
}