Maximum Width Of Binary Tree

medium
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.

Constraints

0 <= Number of Nodes <= 10^5
-1000 <= value of Node data <= 1000

Notice

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.

Example

Input
1 3 5 null null 3 null null 2 null 9 null null
Output
4
Previous
Burning Tree 2
Next
Path Sum Equal To Given Value

Related Questions