Given the root of a binary search tree, return a balanced binary search tree containing the same node values. If there are multiple valid answers, return any of them.
Note: A binary search tree is balanced if the depth difference between the two subtrees of every node is at most
.
Constraints:
The number of nodes in the tree is in the range
Node.val
Given the root of a binary search tree, return a balanced binary search tree containing the same node values. If there are multiple valid answers, return any of them.
Note: A binary search tree is balanced if the depth difference between the two subtrees of every node is at most
.
Constraints:
The number of nodes in the tree is in the range
Node.val