Amazon.com Interview Question
1,589 Interview Reviews |
Back to all Amazon.com Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Development Engineer II at Amazon.com:
Write an algorithm to find the minimum-depth of a binary tree.
See more for this Amazon.com Software Development Engineer II Interview
Helpful Question?
Yes |
No
Inappropriate?



0 of 0 people found this helpful
by Eman:
return ((!nb1 && !nb2) ? nb1 : ((nb1 < nb2) ? nb1 : nb2));
}
int minDepth(treeNode *nptr) {
if (!nptr) return 0;
return 1 + minOfTwo((minDepth(nptr->leftSubTree), minDepth(nptr->rightSubTree));
}