(root)
| 21 | }; |
| 22 | |
| 23 | const isAcceptableHeight = (root) => { |
| 24 | const left = getHeight(root.left); |
| 25 | const right = getHeight(root.right); |
| 26 | |
| 27 | const difference = Math.abs(left - right); |
| 28 | |
| 29 | return difference <= 1; |
| 30 | }; |
| 31 | |
| 32 | const getHeight = (root) => { |
| 33 | const isBaseCase = root === null; |
no test coverage detected