Skip to content

Commit e9cf3b5

Browse files
authored
Merge pull request gzc426#392 from Ostrichcrab/patch-1
Create Ostrichcrab.md
2 parents c86af9f + 9429c15 commit e9cf3b5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

2018.12.07-leetcode104/Ostrichcrab.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```
2+
/**
3+
* Definition for a binary tree node.
4+
* struct TreeNode {
5+
* int val;
6+
* TreeNode *left;
7+
* TreeNode *right;
8+
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
9+
* };
10+
*/
11+
class Solution {
12+
public:
13+
int maxDepth(TreeNode* root) {
14+
if(root==NULL) return 0;
15+
return max(maxDepth(root->left),maxDepth(root->right))+1;
16+
}
17+
};
18+
```

0 commit comments

Comments
 (0)