Problem Description
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
1 <= number of nodes <= 105
First and only argument is root node of the binary tree, A.
Return a 2D integer array denoting the zigzag level order traversal of the given binary tree.
Input 1:
3 / \ 9 20 / \ 15 7
Input 2:
1 / \ 6 2 / 3
Output 1:
[ [3], [9, 20], [15, 7] ]
Output 2:
[ [1] [6, 2] [3] ]
Explanation 1:
Return the 2D array. Each row denotes the traversal of each level.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.