diff --git a/solution/0100-0199/0104.Maximum Depth of Binary Tree/Solution.cpp b/solution/0100-0199/0104.Maximum Depth of Binary Tree/Solution.cpp new file mode 100644 index 0000000000000..7776c044453b8 --- /dev/null +++ b/solution/0100-0199/0104.Maximum Depth of Binary Tree/Solution.cpp @@ -0,0 +1,9 @@ +class Solution { +public: + int maxDepth(TreeNode* root) { + if (!root) return 0; + int l = maxDepth(root->left); + int r = maxDepth(root->right); + return max(l, r) + 1; + } +}; \ No newline at end of file