Problem
Hints
Solutions
Submissions
Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.
Constraints
The number of nodes in the tree is in the range [0, 5000].
-10^4 <= Node.val <= 10^4
View editorial solution
Back
Python 3.8
Auto-saved · 11 lines
99
1
2
3
4
5
6
7
8
9
10
11
›
⌄
⌄
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class
Solution
:
def
isBalanced
(
self
,
root
:
TreeNode
)
->
bool
:
pass
Console
Run
Submit
Click Run to execute sample tests.