(root)
| 5 | * @return {boolean} |
| 6 | */ |
| 7 | var isBalanced = function (root) { |
| 8 | const isBaseCase = root === null; |
| 9 | if (isBaseCase) return true; |
| 10 | if (!isAcceptableHeight(root)) return false; |
| 11 | if (!isChildBalanced(root)) return false; |
| 12 | |
| 13 | return true; |
| 14 | }; |
| 15 | |
| 16 | const isChildBalanced = (root) => { |
| 17 | const left = isBalanced(root.left); |
no test coverage detected