Delete the Head of a Doubly Linked List

You are given a doubly linked list (as an array of node values from head → tail), where every node carries a value, a forward link to the next node, and a…

You are given a doubly linked list (as an array of node values from head → tail), where every node carries a value, a forward link to the next node, and a backward link to the previous node. Remove the first node of the list and return the head of the list that remains. The node that follows the old head becomes the new head, and its backward link must be set to null because nothing precedes it anymore. The deletion must run in constant time and use constant extra space, with no traversal of the list. If the list is already empty, there is nothing to remove, so return an empty list (null head). For example, with `head = [6, 1, 8, 3]`, the result is `[1, 8, 3]`.

- `0 <= nodes.length <= 10^5` - `-10^9 <= nodes[i] <= 10^9` - The deletion must run in constant time and use constant extra space. - The new head's backward (prev) link must be reset to null.

Example 1: input head = [6,1,8,3]; output [1, 8, 3]. The first node (value 6) is unlinked. The head now refers to the node holding 1, and that node's backward link is set to null since nothing precedes it.

Example 2: input head = [12]; output []. The only node is removed, leaving an empty list whose head is null.

Example 3: input head = []; output []. There is no node to delete, so the empty list is returned unchanged.

Category: Linked List. Topic: linked-list. Difficulty: Easy. Patterns: linked-list-traversal.