Clean C


  • 0
    P
    int minDepth(struct TreeNode* root) {
        if(root == NULL) return 0;
        int l = minDepth(root->left);
        int r = minDepth(root->right);
        if(l == 0 || r == 0) return 1 + l + r;
        return 1 + (l > r ? r : l);
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.