标签:head link lin list == linked node nbsp ever
熟悉了一下linkedlist的构造和处理
1 class Solution { 2 public ListNode reverseList(ListNode head) { 3 if(head == null) return head; 4 if(head.next == null) return head; 5 6 ListNode a = head; 7 ListNode b = head.next; 8 ListNode c = a; 9 head.next = null; 10 while(b != null) { 11 c = a; 12 a = b; 13 b = b.next; 14 a.next = c; 15 16 } 17 return a; 18 } 19 }
标签:head link lin list == linked node nbsp ever
原文地址:https://www.cnblogs.com/goPanama/p/9495876.html