修改目录结构,优化CMakeLists

This commit is contained in:
2024-09-16 08:12:23 +08:00
parent a1127e008f
commit 1e9de7c9c2
27 changed files with 6 additions and 26 deletions

28
src/110.c Normal file
View File

@@ -0,0 +1,28 @@
#include "include/TreeNode.h"
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
int maxHight(struct TreeNode *root)
{
if (!root)
return 0;
return fmax(maxHight(root->left), maxHight(root->right)) + 1;
}
bool isBalanced(struct TreeNode *root)
{
if (!root)
return true;
if (!isBalanced(root->left))
return false;
if (!isBalanced(root->right))
return false;
return abs(maxHight(root->left) - maxHight(root->right)) <= 1;
}
int main()
{
return 0;
}