Delete the middle node of linked list

Опубликовано: 25 Сентябрь 2026
на канале: MostOptimal
No
0

Delete the Middle Node of a Linked List | LeetCode Explained

In this video, we solve the Delete the Middle Node of a Linked List problem from LeetCode.
Given the head of a singly linked list, the task is to delete the middle node and return the modified list.

🔍 Problem Overview

Input: Head of a singly linked list

Output: Head of the linked list after deleting the middle node

Definition: If the list has n nodes, the middle node is at index n / 2 (0-based)

💡 Approach Explained

Use the slow and fast pointer technique

Move slow by one step and fast by two steps

When fast reaches the end, slow will be at the middle

Keep track of the previous node to delete the middle node

⏱️ Time & Space Complexity

Time Complexity: O(n)

Space Complexity: O(1)

✅ Key Concepts Covered

Singly linked list operations

Slow and fast pointers

Pointer manipulation

Handling edge cases (single-node list)

🎯 Why Watch This Video?

✔ Easy and intuitive explanation
✔ Optimized one-pass solution
✔ Clean and interview-ready code
✔ Common linked list interview problem

🔖 Tags / Hashtags

#LeetCode #LinkedList #DeleteMiddleNode #TwoPointers #DSA #CodingInterview #Java