public ListNode reverseList(ListNode head) { if(head==null || head.next ==null){ return head; } ListNode cur = head.next; head.next = null; while(cur!=null){ ListNode tmp = cur.next;//保留后面的链表头 //处理当前结点 cur.next = head; head = cur; cur = tmp; } return head; }