Skip to content

Commit b1f2860

Browse files
authored
Create 104. Maximum Depth of Binary Tree 16 feb
104. Maximum Depth of Binary Tree
1 parent 72f3133 commit b1f2860

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)