ZigZag Level Order Traversal BT

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).

Example :
Given binary tree

    3
   / \
  9  20
    /  \
   15   7

return

[
         [3],
         [20, 9],
         [15, 7]
]
Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
4374 successful submissions.
Asked In:
  • Amazon
Click here to jump start your coding interview preparation