1class Solution {2 public int maxDepth(TreeNode root) {3 // Base Condition4 if (root == null) return 0;5 // Hypothesis6 int left = maxDepth(root.left);7 int right = maxDepth(root.right);8 // Induction9 return Math.max(left, right) + 1;10 }11}
WPM •0 •0
ACC •0 •0
TIME •0