Oracle
1 DSA problems asked in Oracle coding interviews
0 Easy
1 Medium
0 Hard
All Categories
All
1 problem
Trees1
Delete Node in a BST
Medium
Given the root of a binary search tree and a value `key`, delete the node holding `key` (if there is one) and return the root of the updated BST. Deletion has two stages: search for the node, then remove it. A node with at most one child is replaced by that child. A node with two children takes the value of its **in-order successor** (the smallest value in its right subtree), and that successor is then deleted from the right subtree. Several valid trees can result from a deletion, and any valid BST with the right values is accepted. The walkthrough uses the in-order successor.