Skip to content

Files

Latest commit

af138b3 · Apr 3, 2020

History

History

0110.balanced-binary-tree

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 3, 2020
Apr 3, 2020
Apr 3, 2020

Given a binary tree, determine if it is height-balanced.

For this problem, a height-balanced binary tree is defined as:

a binary tree in which the left and right subtrees of every node differ in height by no more than 1.

Example 1:

Given the following tree [3,9,20,null,null,15,7]:

    3
   / \
  9  20
    /  \
   15   7

Return true.Example 2:

Given the following tree [1,2,2,3,3,null,null,4,4]:

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

Return false.

解题思路## 可能的變化