> For the complete documentation index, see [llms.txt](https://ucan.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ucan.gitbook.io/notes/iterative-inorder-trasversal.md).

# Iterative Inorder Trasversal

{% hint style="info" %}
94\. Binary Tree Inorder Traversal
{% endhint %}

```java

class Solution {
    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> result = new LinkedList<>();
        Stack<TreeNode> stack = new Stack<>();
        while(root!=null || !stack.isEmpty()){
            //push all the way to the left leaf
            while(root!=null){
                stack.push(root);
                root=root.left;
            }
            root = stack.pop();
            result.add(root.val);
            root = root.right;
        }
        return result;
    }
}
```
