|
| 1 | +<h2><a href="https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/">103. Binary Tree Zigzag Level Order Traversal</a></h2><h3>Medium</h3><hr><div><p>Given the <code>root</code> of a binary tree, return <em>the zigzag level order traversal of its nodes' values</em>. (i.e., from left to right, then right to left for the next level and alternate between).</p> |
| 2 | + |
| 3 | +<p> </p> |
| 4 | +<p><strong class="example">Example 1:</strong></p> |
| 5 | +<img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/tree1.jpg" style="width: 277px; height: 302px;"> |
| 6 | +<pre><strong>Input:</strong> root = [3,9,20,null,null,15,7] |
| 7 | +<strong>Output:</strong> [[3],[20,9],[15,7]] |
| 8 | +</pre> |
| 9 | + |
| 10 | +<p><strong class="example">Example 2:</strong></p> |
| 11 | + |
| 12 | +<pre><strong>Input:</strong> root = [1] |
| 13 | +<strong>Output:</strong> [[1]] |
| 14 | +</pre> |
| 15 | + |
| 16 | +<p><strong class="example">Example 3:</strong></p> |
| 17 | + |
| 18 | +<pre><strong>Input:</strong> root = [] |
| 19 | +<strong>Output:</strong> [] |
| 20 | +</pre> |
| 21 | + |
| 22 | +<p> </p> |
| 23 | +<p><strong>Constraints:</strong></p> |
| 24 | + |
| 25 | +<ul> |
| 26 | + <li>The number of nodes in the tree is in the range <code>[0, 2000]</code>.</li> |
| 27 | + <li><code>-100 <= Node.val <= 100</code></li> |
| 28 | +</ul> |
| 29 | +</div> |
0 commit comments