Tree: Height of a Binary Tree

  • + 1 comment

    For anyone having issues with the broken Javascript boilerplate code, you can overwrite the solution function to fix it, you can add this to your code:

    var solution = () =>  {
        const tree = new Tree();
    
        _stdin_array[1]
            .split(" ")
            .map(x => parseInt(x))
            .forEach(value => {
                tree.root = tree.insert(tree.root, value);
            })
    
        const height = treeHeight(tree.root);
        process.stdout.write(`${height}`);
    }
    
    • + 0 comments

      Thank you!