Did not practice trees nearly enough before this.
Use the BST property to recursively search for the node, then handle deletion based on the number of children: if zero or one child, replace with the child; if two children, replace with the inorder successor (or predecessor) and recursively delete that successor. Return the updated root after each recursive call.
Pro tip: Clarify whether the tree can contain duplicate keys and whether you should use the inorder successor or predecessor—mentioning both shows depth. Also, discuss trade-offs like recursion depth vs. iterative approach for skewed trees.
Recursively traverse the BST: if key < node.val, go left; if key > node.val, go right; if equal, you've found the node to delete.
If the node has no children, return null. If it has one child, return that child (which may be null).
Find the inorder successor (leftmost node in right subtree) or predecessor (rightmost in left subtree). Replace the node's value with the successor's value, then recursively delete the successor from the right subtree.
After deletion, return the current node (or the new subtree root) to maintain the tree structure.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.