Skip to content

Commit 3aebd28

Browse files
aQuaaQua
aQua
authored and
aQua
committed
110 修改细节
1 parent 928a65c commit 3aebd28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Algorithms/0110.balanced-binary-tree/balanced-binary-tree.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import (
77
type TreeNode = kit.TreeNode
88

99
func isBalanced(root *TreeNode) bool {
10-
_, isBalanced := cur(root)
10+
_, isBalanced := recur(root)
1111
return isBalanced
1212
}
1313

14-
func cur(root *TreeNode) (int, bool) {
14+
func recur(root *TreeNode) (int, bool) {
1515
if root == nil {
1616
return 0, true
1717
}
1818

19-
leftDepth, leftIsBalanced := cur(root.Left)
20-
rightDepth, rightIsBalanced := cur(root.Right)
19+
leftDepth, leftIsBalanced := recur(root.Left)
20+
rightDepth, rightIsBalanced := recur(root.Right)
2121

2222
if leftIsBalanced && rightIsBalanced &&
2323
-1 <= leftDepth-rightDepth && leftDepth - rightDepth <= 1 {

0 commit comments

Comments
 (0)