We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ec836e commit f38309dCopy full SHA for f38309d
src/main/java/com/fishercoder/solutions/_138.java
@@ -11,10 +11,11 @@
11
public class _138 {
12
13
public RandomListNode copyRandomList(RandomListNode head) {
14
+ /**Key is the original nodes, value is the new nodes we're deep copying to.*/
15
Map<RandomListNode, RandomListNode> map = new HashMap();
16
RandomListNode node = head;
17
- //loop for the first time: copy the node themselves
18
+ //loop for the first time: copy the node themselves with only labels
19
while(node != null){
20
map.put(node, new RandomListNode(node.label));
21
node = node.next;
0 commit comments