Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit af67d52

Browse files
change depth to height
1 parent b6807a6 commit af67d52

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎problems/0104.二叉树的最大深度.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,10 @@ class solution:
402402
def getdepth(self, node):
403403
if not node:
404404
return 0
405-
leftdepth = self.getdepth(node.left) #
406-
rightdepth = self.getdepth(node.right) #
407-
depth = 1 + max(leftdepth, rightdepth) #
408-
return depth
405+
leftheight = self.getdepth(node.left) #
406+
rightheight = self.getdepth(node.right) #
407+
height = 1 + max(leftheight, rightheight) #
408+
return height
409409
```
410410

411411
递归法:精简代码

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /