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.
2 parents 7d94bf5 + b832d00 commit 92fabaeCopy full SHA for 92fabae
java/0450-delete-node-in-a-bst.java
@@ -24,7 +24,7 @@ public TreeNode deleteNode(TreeNode root, int key) {
24
} else if (root.right == null) {
25
return root.left;
26
} else {
27
- TreeNode minVal = minimumVal(root);
+ TreeNode minVal = minimumVal(root.right);
28
root.val = minVal.val;
29
root.right = deleteNode(root.right, minVal.val);
30
}
0 commit comments