June 21, 2022 · 1 min read
https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1
class Solution {
public:
int maxDepth(TreeNode *root) {
if (root == nullptr)
return 0;
return 1 + max(maxDepth(root->left), maxDepth(root->right));
}
};