We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intgetHeight(Node*root){//Write your code hereif(!root){return-1;}intleftDepth=getHeight(root->left);intrightDepth=getHeight(root->right);return(leftDepth>rightDepth?leftDepth:rightDepth)+1;}
Day 22: Binary Search Trees
You are viewing a single comment's thread. Return to all comments →
My solution in c++,hope to help you~