knakul853

Untitled

Jul 22nd, 2020
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. /**
  2. knakul853
  3.  */
  4. class Solution {
  5. public:
  6.     int maxDepth(TreeNode* root) {
  7.         if(!root)return 0;
  8.        
  9.         int l = max(maxDepth(root->left),maxDepth(root->right))+1;
  10.         return l;
  11.     }
  12. };
Add Comment
Please, Sign In to add comment