/**
* Definition for binary tree
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class Solution {
public int maxDepth(TreeNode root) {
preOrder(root,0);
return h;
}
int h=0;
public void preOrder(TreeNode root,int s){
if(root!=
二叉树高度
最新推荐文章于 2023-09-07 09:37:26 发布