Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f38309d

Browse files
edit 138
1 parent 5ec836e commit f38309d

File tree

1 file changed

+2
-1
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+2
-1
lines changed

src/main/java/com/fishercoder/solutions/_138.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
public class _138 {
1212

1313
public RandomListNode copyRandomList(RandomListNode head) {
14+
/**Key is the original nodes, value is the new nodes we're deep copying to.*/
1415
Map<RandomListNode, RandomListNode> map = new HashMap();
1516
RandomListNode node = head;
1617

17-
//loop for the first time: copy the node themselves
18+
//loop for the first time: copy the node themselves with only labels
1819
while(node != null){
1920
map.put(node, new RandomListNode(node.label));
2021
node = node.next;

0 commit comments

Comments
 (0)