@@ -0,0 +1,1286 @@
+package leetcode;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/**%0A * https://leetcode.com/problems/copy-list-with-random-pointer/%0A */%0Apublic class Problem138 %7B%0A    private static class RandomListNode %7B%0A        int label;%0A        RandomListNode next, random;%0A%0A        RandomListNode(int x) %7B%0A            this.label = x;%0A        %7D%0A    %7D%0A%0A    public RandomListNode copyRandomList(RandomListNode head) %7B%0A        Map%3CRandomListNode, RandomListNode%3E map = new HashMap%3C%3E();%0A        for (RandomListNode node = head; node != null; node = node.next) %7B%0A            RandomListNode copy = new RandomListNode(node.label);%0A            map.put(node, copy);%0A        %7D%0A        RandomListNode copyHead = null;%0A        RandomListNode copyNode = null;%0A        for (RandomListNode node = head; node != null; node = node.next) %7B%0A            RandomListNode copy = map.get(node);%0A            if (copyHead == null) %7B%0A                copyHead = copy;%0A                copyNode = copy;%0A            %7D else %7B%0A                copyNode.next = copy;%0A                copyNode = copyNode.next;%0A            %7D%0A            if (node.random != null) %7B%0A                RandomListNode randomCopy = map.get(node.random);%0A                copyNode.random = randomCopy;%0A            %7D%0A        %7D%0A        return copyHead;%0A    %7D%0A%7D%0A

Solve problem 138