Given the root of a BST
root and an integer val. Insert val into the tree while preserving BST properties and return the root.Example 1
Input: root = [5], val = 3
Output: [5,3]
Explanation: 3 becomes the left child of the root.
Output: [5,3]
Explanation: 3 becomes the left child of the root.
Example 2
Input: root = [4,2,7,1,3], val = 5
Output: [4,2,7,1,3,5]
Explanation: 5 is inserted into the right subtree of the root.
Output: [4,2,7,1,3,5]
Explanation: 5 is inserted into the right subtree of the root.