ListNode* deleteMiddle(ListNode* head) {
if(head==NULL || head->next==NULL)
return NULL;
ListNode* slow=head;
ListNode* fast=head->next; //if initializaing fast=head,this step before while fast=fast->next->next;
while(fast->next!=NULL){
fast=fast->next;
if(fast->next==NULL)
break;
else
fast=fast->next;
slow=slow->next;
}
slow->next=slow->next->next;
return head;
}
```