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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Trees problems