MICRON TECHNOLOGY OnCampus OA 2022 | Maximum Width of Binary Tree | BFS Level Order Traversal
Question · Posted Jun 2026
Problem Statement Given the root of a binary tree, return the maximum width of the tree. The width of a level is defined as the number of positions between the leftmost and rightmost non-null nodes at that level, including the null nodes that would exist between them in a complete binary tree representation. In other words, the width is calculated as: Width = Rightmost Position - Leftmost Position + 1 Return the maximum width among all levels of the tree. ...
The full answer & interview discussion are available to premium members.
Log in Create a free account