blob: e6cdb28109ef4b4e5bb6ca736189164fd4332d6b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// 1382. Balance a Binary Search Tree
#include "leetcode.h"
/*
* given the 'root' of a binary search tree, return a balanced binary search
* tree with the same node values. if there is more than one answer, return any
* of them. a binary search tree is balanced if the depth of the two subtrees of
* every node never differs by more than 1.
*/
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
struct TreeNode *balanceBST(struct TreeNode *root) {}
|