标签:
The material from Youtube: https://www.youtube.com/watch?v=PJzgqT2Ujek
1 public static ListNode reverse(ListNode head) { 2 if (head == null || head.next == null) return head; 3 4 ListNode prev = null; 5 ListNode curr = head; 6 ListNode next; 7 8 while (curr != null) { 9 next = curr.next; 10 curr.next = prev; 11 prev = curr; 12 curr = next; 13 } 14 head = prev; 15 return head; 16 }
标签:
原文地址:http://www.cnblogs.com/chengeblair/p/4693698.html