We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NodeDepths problem in algoexpertsolution ques: Need to find the depth of the tree. below is the solution
int nodeDepth(TreeNode t, int ldepth, int rdepth) { if (t == null) { return 0; } else { ldepth = nodeDepth(t.left, ldepth, rdepth) + 1; rdepth = nodeDepth(t.right, ldepth, rdepth) + 1; if (ldepth > rdepth) { return ldepth; } else { return rdepth; } } }
The text was updated successfully, but these errors were encountered:
@balamac Hey, the question (original question on AlgoExpert) asks us to find the sum of all the node depths of the given binary tree. Thanks!
Sorry, something went wrong.
No branches or pull requests
NodeDepths problem in algoexpertsolution
ques: Need to find the depth of the tree.
below is the solution
The text was updated successfully, but these errors were encountered: