private void ListResverse(ListNode head) { ListNode cur,next; if(head == null||head.next == null) return; cur = head.next; while(cur.next!=null) { next = cur.next; cur.next = next.next; next.next = cur; head.next = next; } }
时间: 2024-12-16 20:25:36