一言加载中...
123456789101112131415
static Node nodeReverse(Node head){ if (head == null || head.next == null) return head; Node new_head = null; while (head != null) { Node temp = head; head = head.next; temp.next = new_head; new_head = temp; } return new_head;}
12345678910111213141516
static Node nodeReverse(Node head){ if (head == null || head.next == null) return head; Node begin = head; Node end = head.next; while (end != null) { begin.next = end.next; end.next = head; head = end; end = begin.next; } return head;}