Skip to content

Commit 6808c86

Browse files
committed
104. Maximum Depth of Binary Tree (변수명 수정)
1 parent b5c8317 commit 6808c86

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

maximum-depth-of-binary-tree/okyungjin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ def maxDepth(self, root: Optional[TreeNode]) -> int:
1313
return 0
1414

1515
max_depth = 1
16-
queue = [(root, 1)]
16+
stack = [(root, 1)]
1717

18-
while queue:
19-
node, cur_depth = queue.pop()
18+
while stack:
19+
node, cur_depth = stack.pop()
2020
max_depth = max(cur_depth, max_depth)
2121

2222
if node.left:
23-
queue.append((node.left, cur_depth + 1))
23+
stack.append((node.left, cur_depth + 1))
2424

2525
if node.right:
26-
queue.append((node.right, cur_depth + 1))
26+
stack.append((node.right, cur_depth + 1))
2727

2828
return max_depth

0 commit comments

Comments
 (0)