Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the fastest leaf node.
/*
struct TreeNode{
int val;
TreeNode *left;
TreeNode *right;
*/
class Solution{
public:
int maximumofDepth(TreeNode *root){
if(root == NULL)
return 0;
int l = maximumofDepth(root->left);
int r = maximumofDepth(root->right);
return (l > r ? l : r) + 1;
}
};