We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d933d22 commit 3056234Copy full SHA for 3056234
Algorithms/Easy/94_BinaryTreeInorderTraversal/Solution.py
@@ -0,0 +1,20 @@
1
+class Solution:
2
+ def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
3
+ stack = []
4
+ output_array = []
5
+
6
+ if root is None:
7
+ return output_array
8
9
+ current = root
10
11
+ while current is not None or stack:
12
+ while current is not None:
13
+ stack.append(current)
14
+ current = current.left
15
16
+ current = stack.pop()
17
+ output_array.append(current.val)
18
+ current = current.right
19
20
0 commit comments