Tap here to switch tabs
Problem
Submissions

Problem: Check Completeness of a Binary Tree

Check Completeness of a Binary Tree uses the root to determine whether every level is full except possibly the last, with its nodes as far left as possible.

Statement

Given the root of a binary tree, determine whether it is a complete binary tree.

In a complete binary tree, every level except possibly the last is completely filled, and all nodes in the last level are positioned as far left as possible. The deepest level hh can contain anywhere from 11 to 2h2^h nodes inclusive.

Constraints:

  • The number of nodes in the tree is in the range [1,100][1, 100].

  • 1≤1 \leq Node.val ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check Completeness of a Binary Tree

Check Completeness of a Binary Tree uses the root to determine whether every level is full except possibly the last, with its nodes as far left as possible.

Statement

Given the root of a binary tree, determine whether it is a complete binary tree.

In a complete binary tree, every level except possibly the last is completely filled, and all nodes in the last level are positioned as far left as possible. The deepest level hh can contain anywhere from 11 to 2h2^h nodes inclusive.

Constraints:

  • The number of nodes in the tree is in the range [1,100][1, 100].

  • 1≤1 \leq Node.val ≤1000\leq 1000