[LeetCode] Balanced Binary Tree
来源:互联网 发布:贵州大数据先天优势是 编辑:程序博客网 时间:2024/06/08 07:53
int height(TreeNode *root) {if(root == NULL) {return 0;}int left_height = height(root->left);int right_height = height(root->right);return left_height > right_height? (left_height+1) :(right_height+1);}bool isBalanced(TreeNode *root) {if(root == NULL) {return true;}if(isBalanced(root->left) && isBalanced(root->right)&& abs(height(root->left)-height(root->right)) <= 1) {return true;}else {return false; }}
0 0
- LeetCode: Balanced Binary Tree
- [LeetCode]Balanced Binary Tree
- LeetCode Balanced Binary Tree
- [Leetcode] Balanced Binary Tree
- LeetCode : Balanced Binary Tree
- LeetCode Balanced Binary Tree
- [LeetCode] Balanced Binary Tree
- 【leetcode】Balanced Binary Tree
- [LeetCode]Balanced Binary Tree
- [LeetCode] Balanced Binary Tree
- [Leetcode]Balanced Binary Tree
- [leetcode]Balanced Binary Tree
- Leetcode: Balanced Binary Tree
- LeetCode-Balanced Binary Tree
- LeetCode - Balanced Binary Tree
- [LeetCode] Balanced Binary Tree
- LeetCode | Balanced Binary Tree
- 【leetcode】Balanced Binary Tree
- 在android4.x中使用自定义的webview中出现ZOOM崩溃的问题
- android播放器MediaPlayer快进报错error (-2147483648, 0)&error (-38, 0),分析log解决问题
- 二,怎样的显卡才是好显卡
- 如何用FFmpeg编写一个简单播放器详细步骤介绍(转载)
- Unity3d 缓存池
- [LeetCode] Balanced Binary Tree
- 配置PL/SQL Developer连接服务器数据库
- 如何让nginx支持ThinkPHP框架(重点参考)
- 又一手机勒索软件现身:不交赎金数据将被永久性破坏
- JAVA 堆内存的分析与配置
- Github上README.md介绍
- 【LeetCode】Best Time to Buy and Sell Stock II &&Integer to Roman
- JSON.parse()和JSON.stringify()
- Spark伪分布式安装(不依赖hadoop)