Given a binary tree, find the leftmost value in the last row of the tree.

**Example 1:**

Input: 2 / \ 1 3 Output: 1

**Example 2: **

Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Output: 7

**Note:** You may assume the tree (i.e., the given root node) is not **NULL**.

Skip to content
# Category: Queue

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Trees## Find Bottom Left Tree Value

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Trees## Find Largest Value in Each Tree Row

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Trees## Invert Binary Tree

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Trees## Binary Tree Level Order Traversal II

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Trees## Symmetric Tree

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Traversals · Trees## Binary Tree Zigzag Level Order Traversal

BFS · Binary Tree · Breadth First Search · leetcode · Queue · Traversals · Trees## Binary Tree Level Order Traversal

Given a binary tree, find the leftmost value in the last row of the tree.

**Example 1:**

Input: 2 / \ 1 3 Output: 1

**Example 2: **

Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Output: 7

**Note:** You may assume the tree (i.e., the given root node) is not **NULL**.

You need to find the largest value in each row of a binary tree.

**Example:**

Input:1 / \ 3 2 / \ \ 5 3 9Output:[1, 3, 9]

Invert a binary tree.

Ex: 4 / \ 2 7 / \ / \ 1 3 6 9

to

4 / \ 7 2 / \ / \ 9 6 3 1

Given a binary tree, return the *bottom-up level order* traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).

For example:

Given binary tree `[3,9,20,null,null,15,7]`

,

3 / \ 9 20 / \ 15 7

return its bottom-up level order traversal as:

[ [15,7], [9,20], [3] ]

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).

For example, this binary tree `[1,2,2,3,4,4,3]`

is symmetric:

1 / \ 2 2 / \ / \ 3 4 4 3

But the following `[1,2,2,null,3,null,3]`

is not:

1 / \ 2 2 \ \ 3 3

**Note:**

Bonus points if you could solve it both recursively and iteratively.

Given a binary tree, return the *zigzag level order* traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).

For example:

Given binary tree `[3,9,20,null,null,15,7]`

,

3 / \ 9 20 / \ 15 7

return its zigzag level order traversal as:

[ [3], [20,9], [15,7] ]

Given a binary tree, return the *level order* traversal of its nodes’ values. (ie, from left to right, level by level).

For example:

Given binary tree `[3,9,20,null,null,15,7]`

,

3 / \ 9 20 / \ 15 7

return its level order traversal as:

[ [3], [9,20], [15,7] ]