Java递归
class Solution {
public ListNode deleteDuplication(ListNode head) {
if(head==null||head.next==null) return head;
ListNode next=head.next;
if(head.val==next.val){
while(next!=null&&head.val==next.val){
next=next.next;
}
head=deleteDuplication(next);
}else head.next=deleteDuplication(next);
return head;
}
}
好牛逼的思路
递归好强!