Skip to content

Commit 446b964

Browse files
refactor 450
1 parent 813f54e commit 446b964

File tree

1 file changed

+0
-41
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-41
lines changed

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

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,6 @@
22

33
import com.fishercoder.common.classes.TreeNode;
44

5-
/**
6-
* 450. Delete Node in a BST
7-
*
8-
* Given a root node reference of a BST and a key, delete the node with the given key in the BST.
9-
* Return the root node reference (possibly updated) of the BST.
10-
11-
Basically, the deletion can be divided into two stages:
12-
13-
Search for a node to remove.
14-
If the node is found, delete the node.
15-
Note: Time complexity should be O(height of tree).
16-
17-
Example:
18-
19-
root = [5,3,6,2,4,null,7]
20-
key = 3
21-
22-
5
23-
/ \
24-
3 6
25-
/ \ \
26-
2 4 7
27-
28-
Given key to delete is 3. So we find the node with value 3 and delete it.
29-
30-
One valid answer is [5,4,6,2,null,null,7], shown in the following BST.
31-
32-
5
33-
/ \
34-
4 6
35-
/ \
36-
2 7
37-
38-
Another valid answer is [5,2,6,null,4,null,7].
39-
40-
5
41-
/ \
42-
2 6
43-
\ \
44-
4 7
45-
*/
465
public class _450 {
476
public static class Solution1 {
487

0 commit comments

Comments
 (0)