Problem Statment
A singly linked list is given.The task is to delete middle of the linked list according to the given two conditions :
If there are odd number of nodes given : linked list is 1->2->3->4->5 then linked list should be modified to 1->2->4->5.
and If there are even nodes, then there would be two middle nodes, we need to delete the second middle element.
Given linked list is 1->2->3->4->5->6 then it should be modified to 1->2->3->5->6.
If the input linked list is NULL or has 1 node, then it should return NULL
Example 1:
Input Format
[1 -> 2 -> 3-> 4-> 5]
Output Format
[1 ->2 ->4 -> 5 ]
Example 2:
Input Format
[1 -> 2 -> 3-> 4-> 5 -> 6]
Output Format
[1 -> 2 -> 3-> 5 -> 6]