← Questions

Copy a linked list with random pointers

0
AppleMetaMicrosoft+2CodingLast asked Oct 2026

A coding interview question asked in Amazon's technical phone screen and at Snowflake, Microsoft and 2 more companies, last asked Oct 2026. It tests linked lists and hash map.

Each node of a singly linked list has a next pointer and a random pointer that can point to any node in the list, to itself, or to nothing. Make a deep copy: new nodes only, with next and random in the copy pointing to the corresponding…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Amazon · Technical phone screen · Last asked Oct 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI
  • Snowflake · Two coding screens · Last asked Aug 202660 min · Two back-to-back live coding rounds, often on the same day; some loops pair coding with system design · Varies: some screens forbid AI, some 2026 screens allow it. The scheduling email says.
  • Microsoft · Coding · Last asked Aug 202660 min · Ten to fifteen minutes of behavioral questions, then coding in HackerRank where you write a main and make the tests pass; usually three rounds · No AI unless the interviewer invites it; some 2026 loops add a round where you bring your own AI agent
  • Apple · Coding · Last asked Jun 2026
  • Meta · Technical phone screen · Last asked Jan 202645 min · Two coding problems in CoderPad, about 20 minutes each · Usually no AI; some newer screens are AI-assisted

What it tests

linked lists · hash map

Your code and the AI tutor open when you unlock this question.