Back to problems

Determine if a Binary Tree is Perfect

Algorithm · Snowflake · Medium

Perfect Binary Tree Medium · Topics · Company Tags · Hints You are given the root of a binary tree. Your task is to decide whether the tree is perfect. A binary tree is called perfect when: every internal node has exactly two children (one left, one right), and all leaf nodes sit on the same level. Write a function that returns true if the provided tree satisfies these two conditions; otherwise, return false. Example 1: Explanation: Every node that is not a leaf has both a…

Checking your access…