[codility]Tree-height

来源:互联网 发布:淘宝客服服务态度培训 编辑:程序博客网 时间:2024/06/14 14:11
// you can also use includes, for example:// #include <algorithm>int getDepth(tree* T){    if(!T) return 0;    return max(getDepth(T->l), getDepth(T->r))+1;}int solution(tree * T) {    // write your code in C++98    return getDepth(T)-1;}

原创粉丝点击