Skip to content

Commit 545672b

Browse files
fix 1485
1 parent 03208e2 commit 545672b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public NodeCopy copyRandomBinaryTree(Node root) {
1212
Map<Node, NodeCopy> map = new HashMap<>();
1313
map.put(root, new NodeCopy(root.val));
1414
dfs(root, map);
15-
dfsAgain(root, map);
15+
dfsRandom(root, map);
1616
return map.get(root);
1717
}
1818

19-
private void dfsAgain(Node root, Map<Node, NodeCopy> map) {
19+
private void dfsRandom(Node root, Map<Node, NodeCopy> map) {
2020
if (root == null) {
2121
return;
2222
}
@@ -31,8 +31,8 @@ private void dfsAgain(Node root, Map<Node, NodeCopy> map) {
3131
copy.random = map.get(root.random);
3232
}
3333
map.put(root, copy);
34-
dfsAgain(root.left, map);
35-
dfsAgain(root.right, map);
34+
dfsRandom(root.left, map);
35+
dfsRandom(root.right, map);
3636
}
3737

3838
private void dfs(Node root, Map<Node, NodeCopy> map) {

0 commit comments

Comments
 (0)