标签:solution ica ext pre next remove duplicate val code
1 class Solution { 2 public ListNode deleteDuplicates(ListNode head) { 3 if(head == null || head.next == null) return head; 4 ListNode node1 = head; 5 ListNode node2 = head.next; 6 while(node2 != null) { 7 if(node2.val == node1.val) { 8 node2 = node2.next; 9 }else { 10 node1.next = node2; 11 node1 = node2; 12 node2 = node2.next; 13 } 14 } 15 node1.next = null; 16 return head; 17 18 } 19 }
83. Remove Duplicates from Sorted List
标签:solution ica ext pre next remove duplicate val code
原文地址:https://www.cnblogs.com/goPanama/p/9655198.html