We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40fd08c commit cbaca32Copy full SHA for cbaca32
maximum-depth-of-binary-tree/PDKhan.cpp
@@ -0,0 +1,9 @@
1
+class Solution {
2
+ public:
3
+ int maxDepth(TreeNode* root) {
4
+ if(root == nullptr)
5
+ return 0;
6
+
7
+ return 1 + max(maxDepth(root->left), maxDepth(root->right));
8
+ }
9
+ };
0 commit comments