Delete node in Doubly Linked List GFG POTD 30 06 2024 solved

Поділитися
Вставка
  • Опубліковано 30 вер 2024
  • code in comments

КОМЕНТАРІ • 1

  • @myKodingacademia
    @myKodingacademia  3 місяці тому

    class Solution {
    public:
    Node* deleteNode(Node* head, int x) {
    Node* temp = head;
    if(x==1){
    temp->next->prev = NULL;
    return temp->next;
    }
    int cnt =1;
    while(cntnext;
    }
    if(temp->next==NULL){
    temp->prev->next=NULL;
    }
    else{
    temp->next->prev= temp->prev;
    temp->prev->next = temp->next;
    }
    return head;
    }
    };