Bloomberg | Phone | Binary Tree Level Order Traversal

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2020-08-18Added By Anonymous
Source: Link
Company: Bloomberg
Role: unknown
Interview Stage: Phone
Location: unknown
Year: unknown

Original Experience:
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 I Output: A B C F D E G H I Question 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