Binary Tree Zigzag Side View
Given a binary tree, return the 'zigzag side view': one node value per level, alternating between the leftmost node on even levels and the rightmost node on odd levels (or vice versa). This is a variation of the Binary Tree Right Side View problem where instead of always selecting the rightmost node at each depth, you alternate between left and right.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid January, 2025
Meta
Senior
Binary Tree Right Side View with variation: Get ZigZag View - return every other left/right node value of the tree, instead of all the right ones
Hello Interview Premium
Your account is free and you can post anonymously if you choose.