Maximum Width Of Binary Tree

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. Given the root of a binary tree, return the maximum width of the given tree.
2. The maximum width of a tree is the maximum width among all levels.
3. The width of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-nodes are also counted into the length calculation.
Input Format
Input is managed for you.
Output Format
Output is managed for you. 
Question Video
0 <= Number of Nodes <= 10^5
-1000 <= value of Node data <= 1000
Sample Input
1 3 5 null null 3 null null 2 null 9 null null
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name