leetcode每日一题-83
public static ListNode deleteDuplicates(ListNode head) {
if(head==null||head.next==null)return head;
ListNode cur=head;
while(cur.next!=null){
if (cur.next.val==cur.val) {
cur.next=cur.next.next;
}else {
cur=cur.next;
}
}
return head;
}
public static ListNode deleteDuplicates(ListNode head) {
if(head==null||head.next==null)return head;
ListNode cur=head;
while(cur.next!=null){
if (cur.next.val==cur.val) {
cur.next=cur.next.next;
}else {
cur=cur.next;
}
}
return head;
}
全部评论
相关推荐
小软-kiki(软可...:没有天生想卷的人,只有被迫努力的普通人。专升本 + 双非硕一路逆袭,你真的已经很厉害了 点赞 评论 收藏
分享