# 144. Binary Tree Preorder Traversal

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?

public static List<Integer> preorderTraversal(TreeNode root) {
List<Integer> res = new ArrayList<Integer>();
if (root == null)
return res;
if (root.left != null) {
}
if (root.right != null) {
}
return res;
}

#### LeetCode 144 — Binary Tree Preorder Traversal（C++ Java Python）

2014-03-02 22:13:14

#### LeetCode(144)Binary Tree Preorder Traversal

2014-01-15 06:29:16

#### 【LeetCode】144 . Binary Tree Preorder Traversal 解题报告

2016-05-22 23:53:41

#### LeetCode144 Binary Tree Preorder Traversal（迭代实现） Java

2016-04-23 13:14:19

#### LeetCode 144 Binary Tree Preorder Traversal（二叉树的前序遍历）+（二叉树、迭代）

2016-03-19 16:15:45

#### leetcode-java-144. Binary Tree Preorder Traversal

2016-06-29 16:46:14

#### 【LeetCode】105. Construct Binary Tree from Preorder and Inorder Traversal 解题报告

2016-06-01 23:42:08

#### [LeetCode-21]Construct Binary Tree from Preorder and Inorder Traversal

2014-05-21 05:59:08

#### Construct Binary Tree from Preorder and Inorder Traversal -- LeetCode

2014-04-24 08:43:09

#### Given a binary tree, return the preorder traversal of its nodes' values.

2017-03-17 14:27:14