We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 72f3133 + b1f2860 commit cde768dCopy full SHA for cde768d
104. Maximum Depth of Binary Tree 16 feb
@@ -0,0 +1,9 @@
1
+class Solution {
2
+public:
3
+ int maxDepth(TreeNode* root) {
4
+ if(root == NULL) return 0;
5
+ int left = maxDepth(root->left);
6
+ int right = maxDepth(root->right);
7
+ return max(left, right) + 1;
8
+ }
9
+};
0 commit comments