企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
## 二叉树的深度 ```java int length(Node root) { int depth1; int depth2; if(root == ) return 0; // 左子树的深度 depth1 = length(root.right); // 右子树的深度 depth2 = length(root.left); if(depth1>depth2) return depth1+1; else return depth2+1; } ```