Copy List with Random Pointer in O(1) Extra Space

Given a singly linked list where each node has a next pointer and a random pointer, create a deep copy of the list.

Requirements:

  • Return the head of the copied list.
  • Every node in the return...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: