0
public static Node deletion(Node head , int pos) {
    if(pos==1) {
        deleteAtHead(head);
        return head;
    }
    
    Node temp=head;
    int count=1;
    while(temp!=null && count!=pos) {
        temp=temp.next;
        count++;
    }
    temp.prev.next=temp.next;
    if(temp.next!=null) {
    temp.next.prev=temp.prev;
    }
    return head;

// temp=null;
}

this is my code here and i'm not sure whats the problem here

  • 5
    Does this answer your question? [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – OH GOD SPIDERS Jun 15 '21 at 14:03
  • Going off this information, you might need to take a look at what happens if `pos = 1` and `head = null`. – Nexevis Jun 15 '21 at 14:12

0 Answers0