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

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.