Search⌘ K
AI Features

Maximum Width of Binary Tree

Try to solve the Maximum Width of Binary Tree problem.

We'll cover the following...

Statement

Given the root of a binary tree, compute the maximum width among all levels 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, inclusive. When measuring width, treat the tree as if it were a complete binary tree, so missing children between existing nodes still count as positions.

Return the maximum width over all levels.

Note: ...