Tips for quick solution

    • Don’t use label as key in hashmap because there may be duplicate label for different nodes
    • Use key as old node and value as newly created node(original->label = new Node(original->label) as key value pairs
    • Now in the second iteration, just set the next and the random pointer.

If you wan’t solution, visit my solution here [C++] For people who want straight forward solution