[LeetCode] Maximum Depth of Binary Tree in Objective C

LeetCode: Maximum Depth of Binary Tree in Objective C

typedef struct {
    int value;
    struct TreeNode *left;
    struct TreeNode *right;
 } TreeNode;

- (int)maximumDepth:(TreeNode *)node
{
    if (!node) return 0;
    return MAX(maximumDepth(node.left), maximumDepth(node.right)) + 1;
}
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center