level 1
这个世界需要她
楼主
public ListNode deleteDuplicates(ListNode head) {
if(head==null||head.next==null)
throw new IllegalArgumentException("the number of nodes must be more than one.");
ListNode head0=head;
ListNode cur=head0.next ;
if(head0==cur){
head0=cur;
}
while(cur.next!=null){
System.out.println(cur);
if(cur==cur.next){
ListNode node=cur.next;
cur.next=node.next;
node.next=null;
}else
cur=cur.next;
}
return head0;
}
方法运行链表不变化 啊
2019年10月22日 08点10分
1
if(head==null||head.next==null)
throw new IllegalArgumentException("the number of nodes must be more than one.");
ListNode head0=head;
ListNode cur=head0.next ;
if(head0==cur){
head0=cur;
}
while(cur.next!=null){
System.out.println(cur);
if(cur==cur.next){
ListNode node=cur.next;
cur.next=node.next;
node.next=null;
}else
cur=cur.next;
}
return head0;
}
方法运行链表不变化 啊
