```
let isBalanced = function(root) {
let isBalancedHelper = (n) => {
if (!n) return 0;
let left = isBalancedHelper(n.left);
if (left === -1) return -1;
let right = isBalancedHelper(n.right);
if (right === -1 || Math.abs(left - right) > 1) return -1;
return ( 1 + Math.max(left, right));
};
return (isBalancedHelper(root) > -1);
};
```