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 f6d6b31 commit b832d00Copy full SHA for b832d00
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