Skip to content

Commit 19f0768

Browse files
author
Joseph Luce
authored
Update 112_path_sum.md
1 parent 81c5f9a commit 19f0768

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

leetcode/easy/112_path_sum.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Solution:
2727
return has_path_sum_helper(root, 0, sum)
2828
```
2929

30-
## Iterative Solution (Lazy Approach)
30+
## Lazy Iterative Solution
3131
- Runtime: O(N)
3232
- Space: O(N)
3333
- N = Number of nodes in tree
@@ -58,6 +58,9 @@ class Solution:
5858

5959

6060
## Inorder Iterative Solution (Preferred Approach)
61+
- Runtime: O(N)
62+
- Space: O(N)
63+
- N = Number of nodes in tree
6164

6265
This implementation is similar to the above approach, however, it falls in line with how you would do an inorder traversal iteratively due to backtracking. It is important to fully understand this implementation. Try drawing it out if it confuses you, it will click better. Then try it doing pre-order and post-order traversals.
6366

0 commit comments

Comments
 (0)