Skip to content

Commit 8b8b157

Browse files
author
Joseph Luce
authored
Update and rename 94_binary_tree_inorder_traversal.md to 094_binary_tree_inorder_traversal.md
1 parent 8131002 commit 8b8b157

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

leetcode/medium/94_binary_tree_inorder_traversal.md renamed to leetcode/medium/094_binary_tree_inorder_traversal.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- N = Number of elements in tree
77

88
Make sure you understand the recursive solution first before attempting the iterative one.
9-
The main point is to understand the recursive call and how it backtracks to the previous call when it reaches the base case.
9+
The main point is to understand is the recursive call and how it backtracks to the previous call when it reaches the base case.
1010

1111
```
1212
class Solution:
@@ -41,10 +41,10 @@ class Solution:
4141
stack, result = list(), list()
4242
curr_node = root
4343
while True:
44-
if curr_node is not None:
44+
if curr_node is not None: # Going down the tree
4545
stack.append(curr_node)
4646
curr_node = curr_node.left
47-
elif len(stack) > 0:
47+
elif len(stack) > 0: # Going up the tree (backtracking)
4848
curr_node = stack.pop()
4949
result.append(curr_node.val)
5050
curr_node = curr_node.right

0 commit comments

Comments
 (0)