• + 0 comments

    Here is my c++ solution, you can have the video explanation here : https://youtu.be/EjWw69vLVYo

    SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* llist, int position) {
        if(position == 0) return llist->next;
        SinglyLinkedListNode* curr = llist;
        while(position - 1) {
            curr = curr -> next;
            position--;
        }
        curr->next = curr->next->next;
        return llist;
    }