Balanced Binary Tree
Given a binary tree, determine if it is height-balanced. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.

30:00

Balanced Binary Tree
easy
Topics
Companies

Given a binary tree, determine if it is height-balanced. A height-balanced binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.

Example 1:
Input: {"root":[3,9,20,null,null,15,7]}
Output: true
Constraints:
  • The number of nodes is in the range [0,5000][0, 5000].

  • 104Node.val104-10^4 \leq \text{Node.val} \leq 10^4

Input
arr ={"root":[3,9,20,null,null,15,7]}

3

9

20

15

7

Variables
VariableValue
curr3
DepthFunction Call
0dfsnode=3
0/25