Binary Tree Zigzag Level Order Traversal
Understand and solve the interview question "Binary Tree Zigzag Level Order Traversal".
We'll cover the following
Description
Given a binary tree T
, you have to find its nodes’ zigzag level order traversal. The zigzag level order traversal corresponds to traversing nodes from left to right and then right to left for the next level, alternating between.
You have to return the element in each level in a two-dimensional
array.
Let’s look at an example:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.