Clone a list with jump links
Each node of a singly linked list has val, next and jump, where jump points at any node of the same list (itself included) or is None. Write clone(head): return the first node of a deep copy, made of new nodes with the same values, whose next and jump point at the copy's own nodes in the same positions. Values can repeat. Leave the original list as you found it.
Aim for O(n) time; O(1) extra memory besides the copy is possible.
The tests call the provided run_clone(values, jumps): jumps[i] is the index of the node that node i jumps to, or null for none. It returns your copy's values and, for each copy node, the index its jump points at.
Examples
run_clone([7,13,11,10,1], [null,0,4,2,0])→[[7,13,11,10,1],[null,0,4,2,0]]run_clone([1,2], [1,1])→[[1,2],[1,1]]run_clone([], [])→[[],[]]