92. Zigzag Level Order Traversal
MediumTrees
Return the values of a binary tree level by level, alternating direction: the first level left to right, the second right to left, and so on. Return one array per level.
A binary tree is passed as TreeNode objects with val, left and right. The tests write trees in level order, with null for a missing child.
Example 1
Input: root = [3, 9, 20, null, null, 15, 7] Output: [[3], [20, 9], [15, 7]]
Constraints
0 ≤ nodes ≤ 2000