You get the root of a binary tree. Picture each level of the tree laid out as it would be in a complete binary tree, with an empty slot wherever a node is missing. The width of a level is the number of slots from its leftmost node to its rightmost node, counting both ends and every empty slot between them.
Return the largest width over all levels. Empty slots to the left of a level's leftmost node, or to the right of its rightmost node, don't count.
The bottom level holds 1, an empty slot under 7, then 6 and 3: four slots from end to end.
In a complete tree the bottom level would have 8 slots. 1 is in the first and 4 in the last, so all 8 count, though only 2 hold nodes.
Every level holds a single node, so every width is 1.
Constraints
1 and 3000 nodes.-100 <= Node.val <= 1002³¹ - 1.Number the slots as in a complete tree: the root is 0, and a node in slot p has its children in slots 2p and 2p + 1. A level's width is its rightmost slot minus its leftmost slot, plus one.
4