InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Delete middle node of a Linked List

Given a singly linked list, delete middle of the linked list.

For example, if given linked list is 1->2->3->4->5 then linked list should be modified to 1->2->4->5

If there are even nodes, then there would be two middle nodes, we need to delete the second middle element.

For example, if given linked list is 1->2->3->4->5->6 then it should be modified to 1->2->3->5->6.

Return the head of the linked list after removing the middle node.

If the input linked list has 1 node, then this node should be deleted and a null node should be returned.

Input Format

The only argument given is the node pointing to the head node of the linked list
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Delete middle node of a Linked List on Interview Code Editor
  • Hints are not available for this problem


Click here to start solving coding interview questions