Company: Bounteous × Accolite_28oct
Difficulty: medium
BST Leaf Nodes after Operations Problem Description You are given a sequence of operations to perform on a Binary Search Tree (BST). The operations consist of inserting ( "insert x" ) or deleting nodes ( "delete x" ) in the BST. After performing all operations, you are required to output the leaf nodes of the final BST, from left to right. BST Invariant: The BST follows the standard rule: For any node with value v , all values in the left subtree are < v , and all values in the right subtree are > v . Custom Deletion Rule: When deleting a node: If the node has a right child, replace the node with its right child. If the node does not have a right child but has a left child, replace the node with its left child. If the node has no children, simply delete it. This is different from the standard BST deletion rule. Function Description: Provide implementation for method String getLeafNodes(operations) . getLeafNodes has the following parameter(s): operations : string array containing