Bloomberg | Phone | Binary Tree Level Order Traversal
Anonymous User
2361
Aug 18, 2020
Aug 19, 2020
Question I: I was asked to print the Binary Tree according to the levels initially.
https://leetcode.com/problems/binary-tree-level-order-traversal/
The output must be from left to right.
Input:
A
/ \
B C
/ / \
F D E
/ \ \
G H IOutput:
A
B C
F D E
G H I
Qustion II: The question was then modified to print output in Zigzag fashion as depicted below for the same binary tree. https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
New Output (zigzag):
A
C B
F D E
I H G
Comments (6)


