We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b152b23 commit 8287062Copy full SHA for 8287062
src/main/java/com/fishercoder/solutions/_145.java
@@ -24,8 +24,8 @@ public class _145 {
24
/**A tricky one: Modify the code for pre-order traversal so that it becomes root->right->left, and then reverse the result to get left->right->root.*/
25
public static List<Integer> postorderTraversal_iterative(TreeNode root) {
26
List<Integer> result = new ArrayList();
27
- Stack<TreeNode> stack = new Stack();
28
if(root == null) return result;
+ Stack<TreeNode> stack = new Stack();
29
stack.push(root);
30
while(!stack.isEmpty()){
31
root = stack.pop();
0 commit comments