Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Copy List With Random Pointer

Medium Linked List

Each node has a value and a random pointer to any node in the list (or null). Create a deep copy and print, for each node of the copy in order, its value and the index its random pointer targets (-1 for null).

Constraints

0 <= n <= 1000 -10^4 <= value <= 10^4

Discussion

No discussions yet.

Rewards · v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.