Skip to content

#450 - Delete Node in a BST

MediumBinary Search Tree
Open on LeetCode

Given the root of a BST and a key, delete the node with that key and return the root of the modified BST. The tree must remain a valid BST after deletion.

InputOutput
root = [5,3,6,2,4,null,7], key = 3[5,4,6,2,null,null,7]
root = [5,3,6,2,4,null,7], key = 0[5,3,6,2,4,null,7]
root = [], key = 0[]

Released under the MIT License.