【leetcode】移除链表元素

 

复制代码
struct ListNode* removeElements(struct ListNode* head, int val){ 
    if (head == NULL) {
        return NULL;
    }     

    head->next = removeElements(head->next, val);
    return head->val == val ? head->next : head;
}
复制代码

 

posted @   温暖了寂寞  阅读(102)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示