Skip to main content
Intermediate~6 min · +40 XP

Linked List Surgery

Practices: Linked Lists

Problem

Start with the singly linked list: 4 → 8 → 15 → 16 (head is 4).

Perform: prepend(2), then remove(8), then append(23).

What is the final list from head to tail? (Format: comma-separated, like 1,2,3)

Examples

  • in: list 5→9, then prepend(1), remove(9)

    out: 1,5

    Prepend adds at head; remove unlinks the first matching node.

Constraints & conventions

  • Removal unlinks the FIRST node with that value.

Your answer

Solve the challenge to unlock the full approach and complexity analysis.