Delete a node from a binary search tree

0
Remix

Given the root of a binary search tree and a key, delete the node with that key and return the root, keeping it a valid BST. Handle the cases of a leaf, a node with one child, and a node with two children (replace it with its in-order successor or predecessor).

GoogleCodingLast asked Apr 2025
No answer yet. Write the first one; the best answer gets endorsed.