leetle

Daily challenge for 2025-09-28

271. Maximum Width of Binary Tree

Given the root of a binary tree, return the maximum width of the given tree. The maximum width of a tree is the maximum width among all levels. The width of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes).

For this problem, return the maximum width found. Input is given as level-order array where null represents no node.

Example:
Input: root = [1,3,2,5,3,null,9]
Output: 4

Run this challenge interactively in Python or JavaScript when the app loads.