【leetcode】删除排序链表中的重复元素

 

struct ListNode* deleteDuplicates(struct ListNode* head){
    if (!head) return NULL;    
    head->next = deleteDuplicates(head->next);
    return (head->next && head->val == head->next->val)? head->next: head;     
}

 

posted @ 2020-09-09 10:42  温暖了寂寞  阅读(144)  评论(0编辑  收藏  举报