What is the tree looks like? I think it like this:
1 / \ 2 2 / \ / \ 3 # # 3 / \ /\ 4 # # 4
Correct? Why this tree is not balanced?
A balanced binary tree is commonly defined as a binary tree in which the depth of the left and right subtrees of every node differ by 1 or less, although in general it is a binary tree where no leaf is much farther away from the root than any other leaf.
This had been asked before, see my answer here: Two different definitions of balanced binary tree result in two different judgments
the problem require that the depth of the two subtrees of every node never differ by more than 1.
the subtree of node 2 is not balanced.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.