Skip to content

Commit

Permalink
175
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangshanmeta committed Nov 4, 2024
1 parent 0cb7fef commit 83d4dca
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/LCR175.er-cha-shu-de-shen-du-lcof.100319/solution.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
* this.left = left;
* this.right = right;
* }
* }
*/
class Solution {
public int calculateDepth(TreeNode root) {
if(root == null){
return 0;
}
return Math.max(calculateDepth(root.left),calculateDepth(root.right) )+1;
}
}

0 comments on commit 83d4dca

Please sign in to comment.