publicListNodedeleteDuplicates(ListNode head){
if(head==null||head.next==null)return head;ListNode p = head;while(p!=null&&p.val==head.val) p = p.next;//找到第一个和head不等的节点pif(head.next==p) head.next =deleteDuplicates(p);//如果p是head的next,说明不重复else head =deleteDuplicates(p);//重复return head;}