Question
Deletion of a Node in a BST
Given the root of a binary search tree (BST) and a key, remove the node whose value matches the key (if it exists). After performing the deletion, return the updated root of the BST.
Input
Your Task
Since this is a functional problem, you do not need to handle input or output. Your task is to complete the function deleteNode(), which takes the root and key value as the input parameter.

Custom Input
The first line of input contains an integer, N, representing the number of nodes in the tree.
The next line consists of space-separated integers denoting the level order traversal of the tree, where non-negative values represent node values, and -1 indicates a null node.
The next line of input contains a single integer key, representing the target value to be deleted.
Note: Once a node is marked as -1, no further information about its children is provided.
Output
Return the root of binary search tree after deleting key from BST. If target node is deleted from the tree it will print yes otherwise no
Example
Input:
6
5 3 6 2 4 -1 7
3
Output:
yes
Explanation:

The above given image depicts the reordered BST after deleting the node with value 3.
Note: The tree can be reordered in mutiple possible ways, You can perform any of them

Online