Delete Head of Linked List

easy

Given the head of a singly linked list, delete the first node (the head) and return the head of the modified list.

After removing the front node, the node that was second becomes the new head. Detach the old head cleanly — its next pointer should no longer reference the list.

If the list has a single node, deleting the head leaves an empty list, so you return an empty (null) head.

Hints

You don't need to change any node except the first — what defines where the list starts?
The answer is whatever comes right after the current front node.
Point head at head.next, detach the old node, and return the new front — all in constant time.

Common doubts

Deleting its only node leaves an empty list, so you return null (an empty head).
No. The head is directly accessible, so removal is a single pointer move — no scanning required.
It detaches the removed node from the list, avoiding dangling references or leaks in languages with manual memory management.

Interview follow-ups

You must walk to the second-to-last node and set its next to null — that's O(n) because a singly linked list has no back pointer.
Advance a pointer to the node just before position k, then repoint its next past the target — O(k) traversal followed by an O(1) splice.

Fun facts

  • Deleting the head of a singly linked list is O(1), while deleting the head of an array is O(n) because every remaining element must shift left.
  • This exact 'advance the head pointer' move is how a stack implemented on a linked list performs its pop operation.

Asked at

AmazonMicrosoftAdobe
Frequently Sometimes Occasionally
Example 1
Input: head = [1, 2, 3, 1, 7]
Output: 2 -> 3 -> 1 -> 7
The first node (value 1) is removed, leaving 2 -> 3 -> 1 -> 7.
Example 2
Input: head = [1, 5, 7, 8, 99, 100]
Output: 5 -> 7 -> 8 -> 99 -> 100
Dropping the front node leaves 5 -> 7 -> 8 -> 99 -> 100.
Constraints

- 1 <= number of nodes <= 10^5 - 1 <= node value <= 10^5

Solve this problem →