• + 0 comments

    Easiest Solution

    public static SinglyLinkedListNode deleteNode(SinglyLinkedListNode head, int index) { SinglyLinkedListNode temp = head;

        if(index == 0){
            head = head.next;
        }else {
           for(int i = 0; i < index - 1; i++){
               temp = temp.next;
            }
            temp.next = temp.next.next;
        }
        return head;
    
    }