Tree: Height of a Binary Tree

 https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree/problem

    int height(Node* root) {
       if(!root) return -1;
       return max(height(root->right),height(root->left))+1;
    }


 

Comments

Popular posts from this blog

Perfect Peak of Array

Is Rectangle?

Sort array with squares!