Medium · Trees
Check Completeness of a Binary Tree
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] → completeOutput: true
Example 2
[1,2,3,4,null,null,7] → notOutput: false
Rebuild it in the studio
Core interview problems are free with a full runner and lessons; Pro opens the complete library.