145. Delete Node in a BST

Given the root of a BST root and a key key. Delete the node with value key and return the root of the updated tree.
Example 1
Input: root = [0], key = 0
Output: null
Explanation: Deleting the only node.
Example 2
Input: root = [5,3,6,2,4,null,7], key = 3
Output: [5,4,6,2,null,null,7]
Explanation: Deleting a node with two children.
binary search treebinary treemediumrecursiontree
JavaScript
Loading...
Line 1, Char 1