You are viewing a single comment's thread. Return to all comments →
I have similar solution like you. this is very easy problem now I got to learn more about recursion.
if(root==null) { return 0; } if(root.left==null&&root.right==null) { return 0; } return Math.max(height(root.left)+1, height(root.right)+1); }
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Height of a Binary Tree
You are viewing a single comment's thread. Return to all comments →
I have similar solution like you. this is very easy problem now I got to learn more about recursion.