删除有序链表中重复的元素-II
用递归对其进行判断即可
public ListNode deleteDuplicates (ListNode head) {
// write code here
if(head==null) return null;
if (head.next!=null&&head.val==head.next.val){
while (head.next!=null&&head.val==head.next.val){
head.next=head.next.next;
}
return deleteDuplicates(head.next);
}
head.next=deleteDuplicates(head.next);
return head;
}