Maximum Width of Binary Tree
Medium
Trees
Tree
BFS
DFS
Find maximum width of tree (distance between leftmost and rightmost nodes at any level).
Constraints
Nodes ≤ 3000
Examples
Example 1:
Input: 1 3 2 5 3 null 9
Output: 4
Example 2:
Input: 1 3 null 5 3
Output: 2
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console