Your question is Check Height-Balanced Binary Tree. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given the root of a binary tree, return True if the tree is height-balanced and False otherwise. A binary tree is height-balanced if, for every node, the heights of its left and right subtrees differ by at most 1.
def is_balanced(root=None, val=None, left=None, right=None):