Copy a List with Random Pointers

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

Each node in a linked list has a next pointer and a random pointer that can point to any node in the list or to nothing. Make a deep copy of the list, and explain how you wire up the copied random pointers.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →