Skip to content

Commit 8e65bee

Browse files
committed
no message
1 parent 61d16c9 commit 8e65bee

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

solutions/94. Binary Tree Inorder Traversal/AC_Iterable_stack.java renamed to solutions/94. Binary Tree Inorder Traversal/AC_Iteration_stack.java

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Definition for a binary tree node.
3+
* public class TreeNode {
4+
* int val;
5+
* TreeNode left;
6+
* TreeNode right;
7+
* TreeNode(int x) { val = x; }
8+
* }
9+
*/
10+
public class Solution {
11+
private List<Integer> res = new ArrayList<Integer>();
12+
public List<Integer> inorderTraversal(TreeNode root) {
13+
if(root != null){
14+
helper(root);
15+
}
16+
return res;
17+
}
18+
19+
private void helper(TreeNode root) {
20+
if (root != null) {
21+
helper(root.left);
22+
res.add(root.val);
23+
helper(root.right);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)