Medium · Trees

Is complete

Given the root of a binary tree, return true if it is complete (every level except possibly the last is completely filled, and the last level's nodes are as far left as possible) and false otherwise. An empty tree is complete.

Examples

Example 1

[1,2,3,4,5,6] → complete

Output: true

Example 2

[1,2,3,4,null,null,7] → not

Output: false

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Trees problems