Given a binary tree, return the *postorder* traversal of its nodes’ values.

For example:

Given binary tree `{1,#,2,3}`

,

1 \ 2 / 3

return `[3,2,1]`

.

**Note:** Recursive solution is trivial, could you do it iteratively?

Skip to content
# Category: Stack

Binary Tree · Depth First Search · DFS · leetcode · Stack · Traversals · Trees## Binary Tree Postorder Traversal

Binary Tree · Depth First Search · DFS · leetcode · Stack · Traversals · Trees## Binary Tree Preorder Traversal

Binary Tree · Depth First Search · DFS · leetcode · Stack · Traversals · Trees## Binary Tree Inorder Traversal

leetcode · Stack## Evaluate Reverse Polish Notation

Given a binary tree, return the *postorder* traversal of its nodes’ values.

For example:

Given binary tree `{1,#,2,3}`

,

1 \ 2 / 3

return `[3,2,1]`

.

**Note:** Recursive solution is trivial, could you do it iteratively?

Given a binary tree, return the *preorder* traversal of its nodes’ values.

For example:

Given binary tree `{1,#,2,3}`

,

1 \ 2 / 3

return `[1,2,3]`

.

**Note:** Recursive solution is trivial, could you do it iteratively?

Given a binary tree, return the *inorder* traversal of its nodes’ values.

For example:

Given binary tree `[1,null,2,3]`

,

1 \ 2 / 3

return `[1,3,2]`

.

**Note:** Recursive solution is trivial, could you do it iteratively?

Evaluate the value of an arithmetic expression in Reverse Polish Notation.

Valid operators are +, -, *, /. Each operand may be an integer or another expression.

Some examples: ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6