var isBalanced = function(root) {
var helper = function(root) {
if (root === null) {
return 0
}
let lh = helper(root.left)
let rh = helper(root.right)
if (Math.abs(lh - rh) > 1) {
flag = false
}
return Math.max(lh, rh) + 1
}
let flag = true
helper(root)
return flag