Copy Linked List with Random Pointer, five ways

Try:
CALL
1 / 1

Code

The highlighted line runs next. The pill shows the live values in the running call.

Cost

Work done so far, and how the five solutions compare

The list

Originals on top, copies underneath

Keyboard: ← → step, Space play or pause. Up to 6 nodes written as [val, random_index] pairs (index 0-based, or null). Java has no defaultdict, so solution 3 uses a small get() helper with computeIfAbsent; C++ uses an equivalent helper. Each copy is drawn under its original.