# Delete Node in a BST

Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.

Basically, the deletion can be divided into two stages:

1. Search for a node to remove.
2. If the node is found, delete the node.

Note: Time complexity should be O(height of tree).

Example:

• leftright都为空：直接删除，返回nullptr即可
• leftright都不为空：默认采用把右子树的节点拉上来的方式，即把左子树插入到右子树中，然后再返回right即可。
• leftright有一个不为空，则返回不为空的子树即可。