# Why expect result of this tree is false?

• Input: {1,2,2,3,#,#,3,4,#,#,4}
Output: true
Expected: false

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?

Thanks.

• `#` means no node there.

This test case looks like below

``````                  1
/    \
2       2
/         \
3           3
/             \
4               4``````

• So this matches with what my understand, Why is his tree unblanced?

• 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,[4] although in general it is a binary tree where no leaf is much farther away from the root than any other leaf.

Reference from wiki

• 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.

• Why the subtree of node 2 is not balanced? The subtree of node 2 is:

3
/
4

why this tree is not balanced?

Thanks.

• The depth of left subtree of node 2 is 2 and that of right subtree of node 2 is 0.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.