Max Depth of Binary Tree Time : Space : 1234567891011121314151617/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */int helper(TreeNode* node, int now) { if(!node) return now; return max(helper(node->left, now + 1), helper(node->right, now + 1));}int Solution::maxDepth(TreeNode* A) { return A != NULL ? helper(A,0) : 0;}