Back to problems

Copy a Random Linked List

Algorithm · Meta · Medium

Problem You are given a linked list where each node contains an integer value, a pointer to the next node, and an additional random pointer that can reference any node in the list (or be null). Your task is to create a deep copy of this list. The new list must consist of brand-new nodes that replicate the original structure exactly: the next pointers must form the same linear sequence, and every random pointer in the copy must point to the corresponding copied node (not to a…

Checking your access…