Delete the Middle Node of a Linked List

You are given a singly linked list represented as an array of node values. Delete the middle node and return the resulting list. The input array represents…

You are given a singly linked list represented as an array of node values. **Delete the middle node** and return the resulting list. The input array represents the linked list in order from **head → tail**. Using 0-based indexing, the middle index is `floor(n / 2)`, where `n` is the number of nodes. When the list has an **even** number of nodes there are two middle nodes — delete the **second** one (the node at index `floor(n / 2)`). For example, `[1, 2, 3, 4, 5]` is 1 → 2 → 3 → 4 → 5; the middle index is `floor(5 / 2) = 2` (value `3`), and deleting it leaves `[1, 2, 4, 5]`. For `[1, 2, 3, 4, 5, 6]` the middle index is `floor(6 / 2) = 3` (value `4`), and deleting it leaves `[1, 2, 3, 5, 6]`. A single-node list becomes empty.

- `1 <= nodes.length <= 10^5` - `-10^9 <= nodes[i] <= 10^9` - The list is a proper singly linked list with no cycles.

Example 1: input nodes = [1,2,3,4,5]; output [1, 2, 4, 5]. Five nodes. Middle index floor(5/2)=2 (value 3) is deleted.

Example 2: input nodes = [1,2,3,4,5,6]; output [1, 2, 3, 5, 6]. Six nodes. Middle index floor(6/2)=3 — the second middle (value 4) — is deleted.

Example 3: input nodes = [7]; output []. A single node is its own middle; deleting it leaves an empty list.

Category: Linked List. Topic: linked-list. Difficulty: Medium. Patterns: linked-list-traversal, fast-slow-pointers.