C# recursive solution


  • 0
    3

    C# recursive solution
    ...
    public ListNode RemoveElements(ListNode head, int val) {
    if(head == null) return null;
    head.next = RemoveElements(head.next,val);
    if(head.val == val) return head.next;
    else
    return head;
    }
    ...


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.