A simple Python recursive solution - 172ms
# Definition for a binary tree node.\n    # class TreeNode:\n    #     def __init__(self, x):\n    #         self.val = x\n    #         self.left = None\n    #
    # Definition for a binary tree node.\n    # class TreeNode:\n    #     def __init__(self, x):\n    #         self.val = x\n    #         self.left = None\n    #         self.right = None\n    \n    class Solution:\n        # @param {TreeNode} root\n        # @return {boolean}\n        def isBalanced(self, root):\n            if not root:\n                return True\n    \n            return abs(self.getHeight(root.left) - self.getHeight(root.right)) < 2 and self.isBalanced(root.left) and self.isBalanced(root.right)\n    \n        def getHeight(self, root):\n            if not root:\n                return 0\n    \n            return 1 + max(self.getHeight(root.left), self.getHeight(root.right))
['Python']