mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
更新 0110.平衡二叉树 排版格式修复
This commit is contained in:
@ -33,8 +33,9 @@
|
|||||||
|
|
||||||
返回 false 。
|
返回 false 。
|
||||||
|
|
||||||
|
## 算法公开课
|
||||||
|
|
||||||
**《代码随想录》算法视频公开课:[后序遍历求高度,高度判断是否平衡 | LeetCode:110.平衡二叉树](https://www.bilibili.com/video/BV1Ug411S7my),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[后序遍历求高度,高度判断是否平衡 | LeetCode:110.平衡二叉树](https://www.bilibili.com/video/BV1Ug411S7my),相信结合视频在看本篇题解,更有助于大家对本题的理解**。
|
||||||
|
|
||||||
## 题外话
|
## 题外话
|
||||||
|
|
||||||
@ -357,7 +358,7 @@ public:
|
|||||||
|
|
||||||
## 其他语言版本
|
## 其他语言版本
|
||||||
|
|
||||||
### Java
|
### Java:
|
||||||
|
|
||||||
```Java
|
```Java
|
||||||
class Solution {
|
class Solution {
|
||||||
@ -498,7 +499,7 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Python
|
### Python:
|
||||||
|
|
||||||
递归法:
|
递归法:
|
||||||
|
|
||||||
@ -620,7 +621,7 @@ class Solution:
|
|||||||
height_map[real_node] = 1 + max(left, right)
|
height_map[real_node] = 1 + max(left, right)
|
||||||
return True
|
return True
|
||||||
```
|
```
|
||||||
### Go
|
### Go:
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
func isBalanced(root *TreeNode) bool {
|
func isBalanced(root *TreeNode) bool {
|
||||||
@ -652,7 +653,7 @@ func max(a, b int) int {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### JavaScript
|
### JavaScript:
|
||||||
|
|
||||||
递归法:
|
递归法:
|
||||||
|
|
||||||
@ -723,7 +724,7 @@ var isBalanced = function (root) {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### TypeScript
|
### TypeScript:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// 递归法
|
// 递归法
|
||||||
@ -741,7 +742,7 @@ function isBalanced(root: TreeNode | null): boolean {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
### C
|
### C:
|
||||||
|
|
||||||
递归法:
|
递归法:
|
||||||
|
|
||||||
@ -876,7 +877,7 @@ func getHeight(_ root: TreeNode?) -> Int {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### rust
|
### Rust:
|
||||||
|
|
||||||
递归
|
递归
|
||||||
|
|
||||||
@ -912,3 +913,4 @@ impl Solution {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user